Is there a way to set NavigationAgent2D's size in the context of a TileMap navigation layer?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By knob


I’ve setup a TileMap with a navigation layer and a NavigationAgent2D to move on click. I’d like to add some dimensions to my nav agent so it doesn’t spill outside tiles that are marked as fully walkable. Essentially, I’m looking for something like the agent_radius property of the NavigationMesh class, but in the context of a TileMap nav layer.

:bust_in_silhouette: Reply From: smix8

No there isn’t.

If you want to do it procedural you can use Geometry2D functions to merge / shink a navigation polygon and use it in a NavigationRegion2D / NavigationPolygonInstance instead of using the TileMap baked navigation.

But first you need to merge all those unwieldy single TileMap tiles into a more managable navigation polygon that represents a larger part your traversable world. Only than can you shrink it to agent size with the Geometry2D functions.