TileMapLayer and multiple NavigationLayers [SOLVED]

Godot Version

4.4

Question

Apologies if this has been covered elsewhere - I’ve searched and found answers that are close, but not quite the same as my query. I have a scene with a TileMapLayer and associated TileSet / TileMap. I’ve associated my “road” tiles with NavigationLayer0 and I have NavigationAgent instances in the scene that use this for the usual pathfinding etc. All this is working great.

What I would like to do is have other NavigationAgents in the scene that can only access a subset of the tiles. So what I thought I should be able to do is associate the more restricted tiles to a new NavigationLayer (1), and then set the bitmask for the more “powerful” agents to Nav layers 0 & 1 but the more restricted agents only get Nav layer 0.

However, I can’t find a way to do this - in particular, the TileSet editor only ever shows me NavigationLayer0.

From reading some posts I’m thinking that what I’m trying to do is impossible, and that I should instead use a second TileMapLayer. But when I do this, I still can’t “create” the second NavigationLayer.

Anyway, if anyone can point me in the right direction that would be great, thanks!

[EDIT: Leaving this post up as it may help others, but feel free to delete if you don’t want old posts hanging around]

So it turns out you can do just what I wanted. I was stupidly looking in the wrong place for the place where you add the second Nav layer - it’s done in the right hand inspector for the TileMapLayer under its TileSet tab (apologies - I find this aspect of the Godot UI a bit unintuitive whereby there are sets of properties under another property that can only be filtered if you expand it). Anyway, once I did this I was able to paint the second nav layer to certain tiles and then set the bits accordingly on different NavigationAgents to control which tiles they can navigate through.

2 Likes

TileMapLayers are very complex and are unintuitive, but they are getting much better. In general the thing to remember is that there are two places to check when changing the way they work: The TileSet instance in the editor (where you found your solution) and then individual TileSets inside the TileSources of the TileSet instance.

1 Like

Thanks @dragonforge-dev - yep, they’re quite complicated alright but improving a lot - just noticed that tiles can now have multiple occlusion polygons!