Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know how to pick the correct tile on a isometric map in 3D space. Here is a 2D example.

They use a colour key map to correctly pick the coordinate. How can I achieve this in 3D space? Is the method similar?

share|improve this question
-1 this question shows lack of research. What have you tried already? – Byte56 Apr 12 '12 at 18:25
Nothing in 3D at the moment, I was just trying to find subjects on it, I haven't had much luck finding examples on the internet. I have used the 2D version with color maps, but I want to convert my project into 3D. – Matthew Underwood Apr 12 '12 at 18:32
Isometric means to represent 3D objects in two dimensions. Typically when people say 3D isometric, they're talking about an isometric map with full 3D objects on it. Maybe explain more about what you have and what you're trying to do. – Byte56 Apr 12 '12 at 18:39
I have probably gone ahead of myself asking this question as I haven't built anything solid in 3D yet and I have only just started with 3D. I have a 2D project at the moment which is a multidimensional array of sprites (tiles drawn on them) they are drawn so they represent a map of tiles. I have the world coordinates which are translated from the screen coordinates. To pick the correct 2D tile I use a color map sprite underneath the map of tile sprites. With 3D I image that I can use 3D primitives instead of sprites. – Matthew Underwood Apr 12 '12 at 18:53
But for picking the correct 3D tile would it be best to use a coloured primitive underneath the map of tiles to find the correct tile? Or am I just going in completely the wrong direction. – Matthew Underwood Apr 12 '12 at 18:56
up vote 1 down vote accepted

The color picking method you linked is suitable for "3D isometric", depending on how you implement it. This is because 3D isometric is not well defined and can have a similar "ground" as 2D isometric. So the tiles will be the same, what will change is the objects in the world. The objects will be 3D and placed so they fit in with the camera angle of your isometric world. A full 3D world would not technically be called isometric.

share|improve this answer

If you are representing your objects as 3D polygons in 3D space, the word to search for is “picking”.

Brief summary: A mouse location is (x,y) in screen coordinates. In your 3d world, the mouse location corresponds to a ray (or line) in world coordinates. You intersect that ray with everything in your world and see what it hits. The closest object that the ray hits is the one that the mouse is pointing at.

If all you want to do is know where on the ground the mouse is pointing, it's fairly easy. You intersect the ray with the plane z = 0. Solve the equation and you get back (x, y, 0) in world coordinates. I recommend doing this even in the regular "2D" isometric world. Color keying tiles on the ground is a lot more complicated than solving this equation (color keying might make sense for more complex shapes though).

If you want to know which of many 3D objects the mouse is pointing at, you intersect the ray with each of the polygons in each of those objects. I recommend starting with brute force: intersect the ray with every polygon and see what hits. Do that first and make sure it gives you the results you want. In practice you'll want to intersect with just a few polygons instead of all of them, using a spatial hash or a gpu buffer with object ids.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.