Isometric maps: how to find the tile under a point object at runtime


Let me try to recap, because my math isn’t adding value. I have an isometric map of 64x64 tiles. The editor displays a diamond-shaped (isometric) map inscribed within a 4096x2048 rectangle, using 64x32 px tiles. If I place a “point” object on the map, the editor translates its coordinates as if I were moving within a Cartesian grid where the origin is the top tip of the map’s diamond shape (located at 2048, 0 screen coords). From there, as I move the object, the coordinates seem to follow the diamond’s matrix structure: X increases as I move along the right diagonal (descending toward the right vertex of the map diamond), and Y increases as I move toward the left vertex. In short, the object’s coordinates follow a Cartesian representation of the map matrix as if it were a square with the origin at the top-left. However, when Libgdx reads the map, it alters the object’s Y-coordinate, adjusting the value as if the Cartesian grid had its origin at the bottom-left. Now I just need a way to determine the specific tile based on the object’s coordinates read from the map at runtime… and that’s where I get stuck—all the formulas I’ve found so far are wrong.