Unintended Teleportation

Thanks for the help on the previous question. As a reminder - in the previous question i was talking about updating the nav mesh periodically based on a changing water presence. As the water gets higher it advances up the terrain and cuts off more land. This is working fine now but exhibits another unintended behaviour.

If one of the nav agents is walking along the coastline and the water advances such that the new nav mesh dissappears from under the agent then the agent is teleporting to the nearest point on the nav mesh.

I’d like to do some game-specific behaviour in this scenario. For example, i want to exhibit the behaviour of the agent getting stuck by playing an animation and asking for help etc. I’m wondering if i need to do a check every frame to see whether the agent is still on the nav mesh and stop their navigating if they are not.

Not sure what the general approach here would be. Any thoughts?


Even with isStopped set to true the agent teleports. The only way i can see to disable navigation entirely is to either disable the RichAI script OR making Traversable Graphs property ‘Nothing’.

Is there a better way?


With the RichAI script, this is not possible to avoid, I’m afraid. I can see two possible solutions:

  1. Push the agent away from the water in some way before you update the navmesh. This way the agent will already be on the valid part of the navmesh before the navmesh changes, resulting in no, or a very small teleportation.
  2. Use the AIPath script instead of the RichAI script. The AIPath script will not constrain the agent to the navmesh (unless the ‘constrain inside navmesh’ option is enabled). The RichAI component requires the agent to be constrained to the navmesh for it to work.


My strategy at the moment is to disable the rich ai script because while the agent is “stuck” or “drowning” i don’t need any navving.

I really hate it though so will try your suggestions.

1 Like