I'm new to the tilemap feature of Unity, and I'm having a hard time with all those coords.
I created a new project, added an isometric tilemap and left all values to their default. In the Unity Editor (and in-game at runtime as well), the coordinates of the cells are like this:
This is pretty disturbing to me and it will be to most players (not programmers) too I guess.
I would like something like this:
However, I can't figure out how to do the transformation.
I tried this:
Vector3 currentWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int currentCellPos = _grid.WorldToCell(currentWorldPos); // This gives the coordinates as in the Unity Editor except for z
currentCellPos.z = 0; // Set z to 0 so the coordinates of the cell are exactly as in the Unity Editor
Vector3 cartesianCellPos = new Vector3((2 * currentCellPos.y + currentCellPos.x) / 2, (2 * currentCellPos.y - currentCellPos.x) / 2, 0); // Try to transform the Unity coordinates into cartesian coordinates: WRONG RESULT
But this calculation gives weird results, not what I expect at all.
Do you know how I could transform the Unity coordinates shown in the first screenshot into the coordinates shown in the second screenshot?