How check different navigation_layers in a TileMapLayer?

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.

If you want to “layer” different navigation meshes on top of each other your need to use different navigation maps and switch your agents between them. See NavigationRegion2D on different layers affecting each other? - #4 by smix8

1 Like