How can I add an additional polygon to the tilemaplayer navigation?

Godot Version

4.4.1

Question

Hi, I am using a TileMapLayer with a Navigation layer and it’s working great but I have a problem. The navigation forms several islands (which is correct, the islands represent rooms). However I now would like to be able to place a door sprite on a wall on the seam between two tiles and have it add an additional square to the navigation mesh to connect the two rooms’ meshes together.

I tried doing this with additional TileMapLayers and that works but it means I have to have two additional layers, one for west-east doors and one for north-south doors and these two layers have to be misaligned compared to the room layer which is all a bit convoluted.

Ideally I’d be able to instantiate a new child scene Door and place it where I want the door and it’ll automatically connect the navigation meshes together.

I tried using NavigationRegion2D and defining a polygon covering the area between the rooms, but I couldn’t seem to get anything to happen when I click bake. I watched some tutorials and they seem to just click Bake and a polygon appears on screen in the editor but nothing happens when I click it.

Is NavigationRegion2D the way to go? If so what am I overlooking? Any ideas?

Thanks,

Gareth

I discovered that this works if I make the NavigationRegion2D’s polygon way bigger than I want. There seems to be loads of padding inside the polygon as shown in this screenshot:

You can see the red border is the polygon I defined and the much smaller blue square is the resulting navigation polygon. I was originally making the red line the desired size and apparently that was so small (once all the padding was added in) that the polygon shrunk to a singularity and vanished.

I’m still unclear why the resulting polygon is much smaller than the one I asked for?