I’m trying to emulate different height levels in an isometric 2D game, to do this I need to know in which navigation_layer the player is.
For example, I have this map:
The grass is layer 1 from navigation_layer
The dirt is layer 2
So whenever the player “jumps” I’ll enable layer 2 in the NavigationAgent and then I need to check if he landed in layer 1 or 2 to keep it enabled.
Also, when he returns from layer 2 to layer 1, I need to disable it.
So in the short term, I have two navigation layers inside a TileMapLayer, and with the player position I need to know in which of them he is. I used cell_source_id, but I’m not sure that is the right way.
I think looking at the TileMap cell source is the right way while you keep things so simple with no cell navmesh overlaps. The TileMap does not give you real access to the internal navigation regions else you could also work with them.
The navigation_layers are just a region filter bitmask for path queries aka they are used to exclude regions with no matching bit from the pathfinding query. So as soon as you have navmesh overlaps with the TileMapLayers things will stop working.
This is because the navigation_layers are NOT a layering system like what the TileMap does with visuals or what physics does with collision layers. All the cell navmeshes still end up at the same navigation map combined. You can’t layer 2d navigation meshes on the same navigation map, that will cause merge and logical problems. The Tilemap does a poor job explaining this.