# Calculate position on Isometric grid

I created the following tile grid in unity3d: The blue dot is the absolute center point (0,0) of both scene space and tile map. Now I am trying to calculate the X/Y position of points on the tile map ( the black coordinates). The red coordinates are positions in the scene space. Every calculation I make just gives me a wrong result. Is the tile map roatated the wrong way? Any help really apreciated!

• Have you considered to have your map orthogonal in scene-space and then just give the camera a diagonal rotation? That should make a lot of things much simpler. – Philipp Feb 6 '17 at 13:44
• Thas is a genius idea! Thanks very much! Unfortunately I coded the whole level editor already so I'm gonna stick to that for a while I guess. But I think that could have safed me some time :D – colosso Feb 6 '17 at 18:35

Looks like you want:

tileExtents = new Vector2(0.3f, 0.17f);

scenePos.x = tileExtents.x * (tilePos.x - tilePos.y);
scenePos.y = tileExtents.y * (tilePos.x + tilePos.y);


so we can solve these equations to get the result:

scenePos.x/tileExtents.x = tilePos.x - tilePos.y
scenePos.y/tileExtents.y = tilePos.x + tilePos.y


adding the two to get x:

scenePos.x/tileExtents.x + scenePos.y/tileExtents.y = 2 * tilePos.x

tilePos.x = (scenePos.x/tileExtents.x + scenePos.y/tileExtents.y) * 0.5f;


subtracting the two to get y:

scenePos.x/tileExtents.x - scenePos.y/tileExtents.y = -2 * tilePos.y

tilePos.y = (scenePos.y/tileExtents.y - scenePos.x/tileExtents.x) * 0.5f