Agent too close too the edge of NavMesh

I’ve got an agent wandering around my scene to random points on the NavMesh. Unfortunately, sometimes it gets too close to and edge, and then it will slip and fall.

I’ve tried making my agent radius bigger, smaller. I’ve put it on an child object and moved toward the front, to the centre. I’ve adjusted the NavMesh Max Slope and Step Height. Yet, this wolf always seems to fall eventually.

Any suggestions on how I can prevent this from happening?

In the video below, I demonstrate the problem I’m facing.

(I’ve cross-posted [here]( Malbers Animals-Creatures page-10#post-3498195))

How are you actually moving the agent? Is there a rigidbody on the agent, and the momentum is just carrying the agent forward off the edge? Are you moving with root motion applied to an animation, such that the animation is forcing the agent forward?

Hmmm … I’m still kinda new to Unity and coding. The creator of the animal assets I’m using could probably answer this better than me, that would be @Malbers .

There is a rigidbody on the gameObject, but Root Motion is also applied. Or, as it is stated on the Animator, root motion is “Handled by Script”.

3499372--278882--upload_2018-5-16_14-19-21.jpg

For the animals I raycast a Fall ray in front of them… so they can predict if there’s a posible cliff…

you can fix this by changing the Front Fall Ray multiplier to 0 on the animal script…

3499390--278883--upload_2018-5-16_13-36-24.png

This should solve it…

but for reassuring purposes you can always put an invisible wall ) to avoid the animal falling from a cliff

Also you can increase the Turn Multiplier To a higher value than 100 so the animal can turn faster and avoid going forward while turning on a 180 degree angle…

Oh my gosh! How could I have missed this!!?
I’m testing these animals now, so far, so good. There is still the occasional fall - but I’m actually okay with that, because it is true to life. I’ll have to figure out a way to script a death if they fall too far.

1 Like