Getting a navmeshagent back on a navmesh.


So, in my game, I’m using the accelerometer to mess with gravity. When the gravity is wrong, I’m un-enabling the navmeshagent scripts on the objects, so they’ll fall all over the place. But when gravity returns, the objects will have to get back up and attempt to go to their destinations again.

From what I can tell, the navmeshagents in my scene need to “reattach” to the navmesh and continue to their original destination. Do I need to perform any special function on the gameobject with the navmeshagent, or do i just have to rotate it back so that it’s standing up, and give it a new destination? Just doing that doesn’t seem to work.

What am I missing?

FIXED: The problem isn’t necessarily the code, though I was able to get this working to some degree by turning the navmeshagent on and off–it’s the navmesh system. It isn’t built to have dynamically moving obstacles. The A* Pathfinding Project (the free version that you can find on the website) is a better, more versatile solution, if a little more difficult to use. I would advise you use that instead.