Problems with baking NavigationPolygon from TileMap

Godot Version

4.4.1

Question

I’m having trouble baking a correct NavigationPolygon from my TileMapLayer.

I have a very simple tileset, with just 2 tiles, a wall and a floor. the floor tile has no collision and has a navigation layer, the wall is the other way around. My first attempt was to just use this directly, which worked, but the navigation had trouble with corners because the navigation mesh wasn’t accounting for agent size. Some Googling told me that what i need to do was creating a NavigationRegion2D and back its NavigationPolygon from the tiles. But when i try to do that i get a really strange polygon that doesn’t cover everything that it should. Here’s a couple screenshots showing how it baked a very simple tilemap and a slightly more complex one.


You can see that there are large chunks in the center of rooms that are not navigable when they should be. Any ideas how i can get this to parse correctly?