Hi everybody !
I’m trying to use the isometric z as y tilemap and create a character on it. I want that the character can snap on the grid case exactly like the tile. But… It work in a way that i can’t understand.
Why do they have different position ? How can i get the tile (and it position) on the gameObject is ? I’m so confuse right now.
Can someone (maybe) explain me, how do we create a lambda character and make it move on the grid ? (with taking the tile’s position where he is standing on ?)
Thank you for reading,
If you know the exact grid position (the one that shows at the first screen you posted), you can use GridLayout.CellToWorld to, as the method name suggests, convert a cell position into a world position. This one receives a Vector3Int with the position relative to the grid.
In order to use CellToWorld you must have a reference to the Grid object (like the one tilemaps use). And if you want to know the current (closest) cell where an object in the world is, you can use the opposite method: GridLayout.WorldToCell. This one receives as parameter a Vector3 corresponding to a point in the world space.
Hope it helps!