Best option for bridging gaps?

Hi

My situation is this: there’s a terrain chunk with buildings scattered around (edit time), using recast graph for navigation. At play time explosions can blow up pieces of walls at random places, opening new paths through the map, which I need to add to the navigation somehow.
Buildings can have arbitrary rotation and wall section sizes and explosions positions/results are totally dependent on player input, so unfortunately the whole thing doesn’t fit into a grid setup at all :frowning:

What’s my best bet for achieving this with navmesh?
One way that seems to work is baking the mesh without solid walls gaps on it, then hanging a ton of small NavmeshCut shapes on them, removing blockers as corresponding wall chunks explode, but you can only get so precise with that without having an insane amount of cut components.
Would trying to make NavmeshAdd work here be any more convenient/is it worth bothering with it in this case?
Hope I’m not missing some stupid simple solution :smiley:

I’m using 4.1.1 Beta, PC for target platform (CPU is underloaded)
Thanks!

Hi

You can recalculate tiles in a recast graph. That will produce results that are exactly the same as if the graph was just scanned. This is offloaded to a separate thread because it is quite slow (and no pathfinding can run while it is in progress).
Essentially the only thing you would have to do is to call

AstarPath.active.UpdateGraphs(bounds);

where bounds is the bounding box of the region that you need to update.
Make sure that the tile size of the recast graph is somewhat reasonable so that a normal update does not have to recalculate a very large region or recalculate a very large number of tiles (the most common values for the tile sizes are around 64, 128, and 256).

See also https://arongranberg.com/astar/docs/graph-updates.php