Hi. I have a simple grid 64x64 exported from Blender. Then I’m using the technique from the TerrainGrid to display a terrain based on an alpha map and tile textures. Everything is working as expected. But now I need to place objects on the map based on the tile coordinates. For example, top left tile is 0,0 and bottom right tile is 63,63 and I try to place an object on tile 39,29. For that I have figured out a system that gives me the vertex position for each tile coordinate. For example the tile 39,29 have the vertex (-8.63492,-2.53968,0) and I can place the object in the grid at those local coordinates.
This works perfect in the center of the grid but the local coordinates are slightly off for tiles that are not in the center. I checked everything in wireframe mode and it fits perfectly. Please see the attached screenshots.
I have done no transformations on the grid and nothing special at all. Each tile is 103x103 pixels on the zoom everywhere. Each vertex is exactly 1.0158 away from the other in x and y axis. All of the textures are 128x128 big.
I expect the white box to be always in the bottom right corner of the tile. Why is it slightly off to the right?
Not much code, because it’s just retrieving the vertex and place the white box there.