Reputation: 685
I have a tile map with 16 tiles like:
each tile have defined navigation (as big as possible):
but Navigation2D in most time return an empty array when I click on a tile
The code can be found on Github: link to repo
Upvotes: 3
Views: 1509
Reputation: 40295
As you might be aware, in the Debug menu in the editor, there are options "Visible Collision Shapes" and "Visible Navigation". Enable them, and play the game.
It will show you, as the names of the options suggest, the collision and navigation shapes. You want to make sure that:
If you see any of these problem, redo the navigation shape for the problematic tiles. Some advice:
A gap between navigation and collision is ok.
Also, remember to edit the TileSet
of your TileMap
. If you are editing a TileSet
independently, you may have to set it to the TileMap
again. Having the Debug options mentioned above, should suffice to notice if it didn't update.
And yes, I downloaded the code from the linked repository, and managed to make it work. Other things I did, but I believe are not important: I made sure there was no repeated points in the navigation shapes (if you find you have to click twice to make the dot appear while editing, you are probably making a repeated point, just click the next position instead). I also moved the collision shape to be centered in the Player.
Upvotes: 3