How to keep track of when AI has left navmesh?

Hi, I have a problem where sometimes my AI enemies get knocked into areas not covered by the navmesh and just freeze. Is there a way of asking to be notified when this happens? Or do I need to do periodic traces against the ground to see if I’m still on the navmesh (and if so, uh, how would that work?).

I’m moving my enemies using a MoveTo task called through a Behavior Tree. I’m surprised by how little control I seem to have over how MoveTo works: I thought there’d be a bunch of options dealing with obstruction and what to do in situations like being blocked by another object or getting knocked off the navmesh. Should I be using MoveTo at all, or would a real programmer create their own custom MoveTo task?

Thank you!

Hey @Sweatymoose2!

A few questions to get things started:

  • Are you looking to specifically wanting to prevent your AI enemies from leaving your nav mesh? Or are you looking to have your AI leave your Nav mesh occasionally and there fore need a dynamic nav mesh?
  • What is causing your AI to leave your nav mesh?
  • Are you using Nav Mesh modifier volumes?

In the meantime, check out these documentation articles and this non-Epic affiliated link for more information and a possible solution:

I hope the above contains the solution you need!

Hi, thank you so much! The video on finding the nearest point on the navmesh was really useful.

I’m making a fast-paced FPS where enemies jump between points on the navmesh. Sometimes if they get knocked off course, they can end up on weird little edges of geometry that aren’t covered by the navmesh, at which point they just freeze.

What I’d love would be some way of getting feedback from the navigation system on whether something is blocked: currently I’m not sure when the MoveTo task will decide it has failed? In fact, I’d love to know more about how MoveTo works under the hood in general.