I made this little thingy, which display kinda isometric floor. Here is how it looks without rotating the matrices.

As expected, finding on which tile mouse is currently at is really easy. Just divide mouse coordinates by tile size..

Here is the image of how it looks when I do my 'isometric' rotations (not sure if this is called isometric

)

Here is the code for making this 'isometric' ground.

1 2 3 4 5 6 7 8 9 10 11 12
| Matrix4 projectionMatrix = new Matrix4(); projectionMatrix.setToOrtho(0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), 0, -1, 1); Matrix4 modelviewMatrix = new Matrix4(); modelviewMatrix.rotate(1, 0, 0, 35); modelviewMatrix.rotate(0, 0, 1, 45);
projectionMatrix.tra(); modelviewMatrix.tra(); isoShader.setUniformMatrix(isoShader.getUniformLocation("u_projectionMatrix"), projectionMatrix, false); isoShader.setUniformMatrix(isoShader.getUniformLocation("u_modelViewMatrix"), modelviewMatrix, false); |

How do I transform screen mouse coordinates to these world coordinates?

1 2 3 4 5 6 7 8 9 10
| float x = Gdx.input.getX(); float y = Gdx.input.getY(); float[] vec = { x, y, 0 };
Matrix4 transformationMatrix = projectionMatrix.cpy(); transformationMatrix.mul(modelviewMatrix);
Matrix4.mulVec(transformationMatrix.val, vec);
System.out.println(vec[0] + " " + vec[1]); |

I tried this code, and in my head, it should work. But it gives not correct values.. As I point along the horizontal axis of the map, the Y is increasing..