Hello everyone,
I’m using unity 2020 and working on a 2D project. I would like to know the Tile coordinate where my mouse is over.
To do so, I use:
Vector3 mouseWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
To get the real world mouse Position. Then,
grid.WorldToCell(mouseWorldPos)
or
tilemap.WorldToCell(mouseWorldPos)
To Get the cell coordinate.
But this doesn’t work with hexagonal Tilemap.
I tried this solution : How to convert game object world position to hex grid cell coordinates? - Questions & Answers - Unity Discussions but the results are incorrect too.
For information, I set my tiles size as following X=2.598 Y=3.
Can Someone help me please ?