Updating layered grid graph

Hi there @aron_granberg,
I have a thing and I don’t know if that’s expected or not (I hope, that it is not tho ^^).

I have a Layer Grid Graph (on a ship with the top-down camera, to visualize it better) with 2 layers: upper and lower deck. On the lower deck, there are several interactive doors. The doors are updating the graph by calling AstarPath.active.UpdateGraphs(guo);

The problem is that when my character goes to the lower deck I disable the upper deck entirely (along with its collider), so when the graph updates, even with the correct bounds (that only cover a small part of the lower deck) it seems that the height testing is still fired for the nodes on the upper deck because the result is that the nodes that are in the area of the update area of the door (looking top down) are removed from the graph. I tried to specify the constraint for the GraphUpdateObject and constraint it to a given layer but it didn’t work.

Is there any way to overcome this? I would really not go the way of custom logic for handling the doors (like the custom manager & some logic in the traversal provider).

Hi

I assume that you disable it to save on rendering costs?
Is it possible for you to disable only the renderers, and leave the colliders intact?

Nope, I don’t think it will work in my case. But why the nodes are being updated outside of provided bounda in the first place? I wpuld assume if I provide the bounds that only the nodes that are inside will be affected somehow.

Hi

The layered grid graph works by shooting rays down from the sky to see what it hits. So when recalculating a region from scratch, it will always update all xz cells in the graph, regardless of their height above the base of the graph. It would be very tricky and probably slow to make it keep the node data for everything outside the bounds on the y axis as well.
All graph updates are written so that they will definitely update the graph to account for changes inside the given bounding box, but they MAY update a larger part of the graph if convenient.

If you set guo.updatePhysics=false and instead use the update to mark nodes as walkable/unwalkable, then it will only updates the nodes strictly inside the bounding box, though.