Godot Version
4.2.1 Stable
Question
I’m trying to wrap my head around what I need to do to get dynamic updates to work with a NavigationRegion. I have a simple strategy game with buildings that I place down. I’m using a tilemap for the layers, and originally, I went with the navigation layer which did provide the basic functions to allow me to use the agent and pathfinding. It was great, until I tried to find a way to update the pathing when I put down structures. Avoidance sort of works, but is not really what I need here. I eventually found articles pointing me away from the tilemap navigation and towards the NavigationServer2D and NavigationRegion2D.
I got that mostly figured out and is working well, including using the tilemap physics layer to create holes/obstacles in the region. I found out how to use NavigationMeshSourceGeometryData2D and rebake the region from the geometry data to update it with any cut-outs I do via add_obstruction_outline. However, when I rebake and add those obstructions, my old data is lost. I would like to retain the original tilemap baked polygons and then cut into those only as needed when I place buildings.
I see how I could iterate through the tiles and create a full bake of everything each time, but that seemed inefficient when compared to a much more simple polygon that had already been produced during the initial tilemap bake.
Can anyone assist me with figuring out how to have a tilemap and buildings that cut out navigation meshes work together in the best way? I’d be grateful.