I'm creating top down game with tile based movement, and I want to add the possibility to move to a position by clicking the mouse button. To do so, I created a function which take an array of directions and follow the path.
I'm using the Navigation2D node to make the pathfinding (I added the tilemap as a child of the Navigation2D) and get the position array, but the points doesn't seems to be correct.
Here is an example:
I'm using this simple function:
var points = navigation.get_simple_path(position, destination, false)
If I click on the marked tile, here is what points contains :
With a tile size of 32px, I don't understand why each position is incremented by 16px.
Also if I click on the tile just to the right of this one, here is what I get :
It seems to make a diagonal movement, but it's probably intented ?
Finally, here is how I created the NavigationPolygonInstance in the Tileset, because it may be related to this :
I think I don't understand how the Navigation2D works, what am I doing wrong ?