# Rotated vs staggered isometric tile selection

This topic is 4641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I have read this article and found it really helpful. I have successfuly drawn a staggered isometric map like this: and have got tile clicking working perfectly using the mouse map method in the above article. However, I am trying to implement now a rotated isometric viewpoint like below: I have managed to draw this but I cannot get tile selection to work at all using the mouse map method. Could anyone offer any help or advice? Many thanks in advance, Garry [Edited by - Garry on January 28, 2006 6:13:51 PM]

##### Share on other sites
Hi garry. I am writing an isometric game engine atm, and Initially I started out using the rotated method. But I also hit a wall when trying to implement mousemapping. I decided to go for the staggered method and havent had any major problems yet. What is your reason for using the rotated method?

##### Share on other sites
Garry,

It shouldn't be necessary to use a mouse mapping method. Your transformation from a regular grid to the isometric grid is simply a rotation and a sheer, so you can do all of the coordinate mapping as a standard matrix transform.

To be honest, I don't know what the actual math would be. So, my first place to check is Google. Searching for "transforming mouse coordinates isometric" gives me Brian Hook's discussion on isometric engines as the first result. This is an excellent article, highly recommended for some fundeamental observations of commercial isometric game engines.

Near the end of his article, he addresses the technical issue of transforming mouse coordinates to map coordinates. Jump to the end of the article for his equations (his graphics are much better than what I could reproduce here).

##### Share on other sites

I use the rotated method and was able to hack out a couple of functions to return the tile that the mouse is over.

float yFactor = (cameraCentreY - halfScreenHeight - mouseYPosition) / Tile.HalfHeight;float xFactor = (cameraCentreX - halfScreenWidth - mouseXPosition / Tile.HalfWidth;float tiley =  (yFactor - xFactor) / 2.0f;float tilex =  (yFactor + xFactor) / 2.0f;

Hopefully it's fairly self explanatory what the variables are. Tile.HalfHeight and Tile.HalfWidth are constants that hare 1/2 tile height and width.

So a final result of tiley = 23.432 and tilex = 10.999 would mean that the mouse was over tile (10,23). Don't round up.

##### Share on other sites
Have you looked at the iso article on here that I wrote?

http://www.gamedev.net/reference/articles/article2026.asp

That article deals with adding height to your diamond / rotated maps, but it has all the code in there to help you work out your mouse maps.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632912
• Total Posts
3009199
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!