AI walks outside of NavMesh
I move the AI using MoveTo (inside a behavior tree) and then assign the TargetLocation as the player location. The player then walks to the end of the ledge shown in the screenshot below. The AI sadly follows the player outside of the navmesh. And then the AI get's stuck because, there is no navmesh where he is standing... But the AI should not ever get outside of the navmesh...
How can I prevent the AI from walking outside of the NavMesh without resorting to 'spamming' invisible walls?
I had the same problem. But the vector solution was not quite right. So editing some properties of the navigation mesh was able to solve it. Now the enemy does not leave the navmesh when he makes a "moveto an actor task"
answered Feb 20 '17 at 05:24 PM
This is still an issue in 2019. I found a pretty good solution to it that allows you to use MoveTo with an Actor while still preventing the AI from moving off the NavMesh and getting stuck. Basically I just created my own very simple Decorator Called BTD_CanMove where I check that the Actor the AI is trying to move to is also on the NavMesh. I then add that Decorator to my MoveTo node in the Behavior Tree.
Hope this helps!
Follow this question
Once you sign in you will be able to subscribe for any updates here