- Home /
Navmesh Agent With Physics?
How can I run the Navmesh Agent in FixedTimestep to interact with physics? After some testing, I found out that it runs with every Update frame so calculated positions aren't synchronous and can't be used with physics.
With a synchronized start, the navigation is deterministic which is why I want to use it in FixedUpdate to be in sync with the cycles of my lockstep RTS game.
You bake the Nav$$anonymous$$esh into a scene so it calculates the available paths, that's done before the game runs and saved in some form of data structure.
When running the game if you set a target it calculates a path but that calculation may take more than one frame to run.
I don't know the full details but more importantly are you actually having any issues with Nav$$anonymous$$esh or is this just a question of curiosity?
Bump, does anyone know this? I couldn't find it in the documentation.
Should be easy enough to test - set the Fixed Timestep to 1. If the Nav$$anonymous$$eshAgent moves only once every second, it's moving based on FixedUpdate. If it moves as before, it's on the normal Update loop.
I'm suspecting Update, as the agents are not using physics in their movement through the navmesh; they just glide along the mesh like dumb ghosts.
Don't know without knowing what you want to achieve but just post a new question saying what you want to do and what testing you've done (just link this question for speed).
Also getting pretty late where I so may not respond immediately.
Just trying to keep answers clearer and give you a better chance to get a fix for what you want to do.
Answer by jpthek9 · Jan 30, 2015 at 10:05 PM
After some tests, I've concluded that pathfinding and navigation run with Update frames. Now I need some way to run it with FixedUpdate for synchronization. http://answers.unity3d.com/questions/889836/using-unity-navigation-in-a-fixed-timestep.html