# Libgdx draw a sprite in top of an isometric tile

I have this isometric map and im using IsometricTiledMapRenderer to render the map I have a OrthographicCamera. I know where each tile is in the isometric map, but the isometric map is kinda rotated?

So I was wondering how to convert Map Coordinates to Isometric and viceversa?

Here I tried to draw a color cube in each tile coordinates....

Thanks in advance, I have been struggling with this for 2 days, and my lack english vocabulary isnt helping with the research, please some one point me to something

Looking at the source code for the Isometric renderer I found this piece of code (slightly edited):

private void init () {

// create the isometric transform
isoTransform = new Matrix4();

isoTransform.idt();

// isoTransform.translate(0, 32, 0);

isoTransform.scale((float)(Math.sqrt(2.0) / 2.0), (float)(Math.sqrt(2.0) / 4.0), 1.0f);

isoTransform.rotate(0.0f, 0.0f, 1.0f, -45);

// ... and the inverse matrix
isoTransform.inv();

}

private Vector3 translateScreenToIso (Vector2 vec) {

Vector3 screenPos = new Vector3(vec.x, vec.y, 0);

screenPos.mul(isoTransform);

return screenPos;

}


Try using this to convert your screen coordinates to Isometric coordinates.

• I tried this Yesterday with no luck :/ thanks for your reply! – centenond May 2 '17 at 23:24
• Actually I tried this again and it just worked, thanks man really thanks alot – centenond May 3 '17 at 0:26