Updating Graph for Rotating Bridge


I am using recast graph on a scene with a rotating bridge. I want to update the graph on the bridges new position every time the animation ends.

I have tried to make an UpdateGraphScene, which its points would encompass the bridge’s possible locations object and use the apply command via script on animation end. (didn’t work)
I tried again on animation end to re-scan the entire graph (which worked but it froze the game for some seconds).
I tried a third time using the bridge’s collider as bounds to update the graph on animation end (didn’t work).

What are the better solutions to this, or what do I do wrong in my attempts thus far?

Thank you.

try navmeshcut/ maybe will be good for you

1 Like

Thanks for the reply.

What I did is that I placed a dummy bridge to where my original bridge ends up to calculate the initial graph and then disable the dummy bridge and activate two cutters that rotate with my original bridge.
So when the bridge rotates it cuts its previous position while the new one gets released from the cuts.
It works as intended however I get a massive 30+fps drop every time the bridge rotates and the graph gets updated.
I switched the navmeshcut check from 0 to -1 and manually check every time the rotation animation ends. However this didn’t seem to improve performance much.
Are there any ways I could improve this solution?

Thank you.

Nevermind, I hadn’t saved the navmeshcut check from 0 to -1 to it still calculated it frame by frame. I change it in code and ForceUpdate it every time the rotation animation ends. It still spikes in the profiler whenever that happens, however it lasts for very few frames and it isn’t noticible

Thanks again for the info

1 Like