Updating Recast at a specific point on terrain

Hello,

I’m looking to update a graph at a specific point in the world when called upon instead of recalculating the whole surface. Right now I’ve made a script that can modify the height of the terrain at runtime I just need to come up with a solution on how to recalculate pathfinding efficiently as recalculating it for the whole terrain is too slow. I’ve had success with doing this on regular objects but can’t seem to get it working on the terrain with recast.

Update on this, I have realized that placing colliders where the terrain was dropped allows me to create the recast data for that area, however if i drop the colliders too low it wont calculate the graph? is there a way to solve that, and would also appreciate any ideas on whether this solution doing things is a good idea or if there is a more performant method

Hi

You can read about graph updates here: https://arongranberg.com/astar/docs/graph-updates.php

Essentially what you need to do is to call

AstarPath.active.UpdateGraphs(bounds);

Where bounds is a bounding box that contains the part of the terrain that you modified.

On recast graphs updates are done on a tile by tile basis, so make sure you are using a tiled recast graph.

I suspect that the bounding box for the graph stops there? You can adjust the bounding box in the graph inspector.