Archived

This topic is now archived and is closed to further replies.

Jiia

Screen to Space Coordinates - How difficult is it?

Recommended Posts

Seriously, just ignore my post if I''m missing something here. I''ve been reading through the reference section, and found some articles about converting screen coordinates to isometric map space coordinates. I only read through about half of it to realize it was making it much more difficult than it had to be. My iso engine is 2D, so I may be missing something. But just in case, I wanted to share my method for converting coordinates. It seems extremely simple for you guys not to already know, so I''m hoping somone will explain why the article went so in depth and what they were trying to do. This is how I convert to map space coordinates: MapCoordX = (POS_X>>1) + POS_Y; MapCoordZ = POS_Y - (POS_X>>1); Z is in-out, not into-the-air-coordinates. And my tiles are 64x31 in size. The usual ratio. Like I said, this seems pretty simple for you guys to not already know, but maybe it helps someone. Shed some light on me if I''m wrong. Jiia

Share this post


Link to post
Share on other sites
the method you are using will work for the specific case of a 2:1 tile ratio. the articles speak of more general purpose solutions, since not all iso maps have a 2:1 ratio.

Share this post


Link to post
Share on other sites
Also, Screen space to Map Sapce is a translation but Screen to Tile is trickier since a given map space coord can land in multipel overlapping tiles.

The "MouseMap" trick Tan shows in his book is an easy and efficient way to resolve that

Share this post


Link to post
Share on other sites