EDIT: nevermind figured it out
Hello, I’m using the grid graph, and looking to carve out pieces of the navmesh at run time, and then fill them back in, on a somewhat regular basis. It is for, when two units/formations of men are in combat, a rectangular carve is made around them so other units don’t path through them, and then it is removed. I’ve tried two solutions. One is to call:
AstarPath.active.UpdateGraphs (unit.collider.bounds);
where the collider bounds is the unit in combat bounds, and that seems to work and is performant, except it just keeps accruing new carves out of the navmesh every time I call it, with no way to find and fill back in the old carved out spot once it is no longer needed, which eventually just makes the map unusable. Is there a way to track every call to update graphs and undo the unneeded carves and keep the still needed ones?
The alternative is to spawn a simple game object prefab for each unit at start that just has the NavmeshCut script on it, is sized to the unit size, and moves down into the graph on moving into combat, and then on moving out of it moves up into the air out of the graph. This works and does not have the above issues, as it only carves when moved into place and un-carves when moves out of place, but it is not very performant. Are there some recommended performance improvements for this type of navmesh cutting? Chnaging the shape, radius expansion, or some such? The update distance shouldn’t make that much of a difference, as I do not move it continuously, but just into place once, and then out of place a long distance maybe 30 seconds later. Would settings on the grid graph make it faster? bigger nodes? Using multiple smaller graphs to cover the map (it’s one big terrain with few features)?
Any recommendations on how you would approach this?
Thanks!