NavMeshAgents act crazy at the NavMesh edges of the generated mesh.

I keep getting this issue where NavMeshAgents go nuts when encoutering a NavMesh edge of the generated mesh (especially when the fps drops), it may even get stuck at the (0,0) point of the NavMesh, I’ve been having this issue for ages and I’m not sure if it’s a bug or not.

I’ve never seen this. How exactly are your agents getting to the edge of the navmesh?

Sounds like you are setting the destination to somewhere it shouldn’t be and I’ll bet there are console errors.

1 Like

When I said edges I meant edges as in like (verticies/edges/faces) and not the border of the navmesh.
What the characters do is they go in zig-zag motions and slow down, as if these edges are an obstacle somehow. Unfortunatley I was not unable to reporduce it now to show it in a gif.

Does the hight of the navmesh destination matter ?

Yes, the height of your destination matters. The destination must intersect the plane of the mesh. The easiest way to assure that you’re placing a target on the mesh is to use NavMesh.SamplePosition.

1 Like

Unfortunately sampling the position still didn’t work. My issue similar to this question.
Also I forgot to say that this happens most when the Time.timeScale is increased.

EDIT: I’m considering switchting to an A* alternative, hoping it delivers a similar kind of performance.

According to the docs the collision avoidance takes into account nav mesh edges, maybe try to set the collision detection to none and see if it solves it?

provided it doesn’t make the game look weird
if that’s the case you could extend the nav mesh a bit and keep the RVO

I think you meant setting the avoidance in the navmesh agent to None as I have no rigidbodies attached to any character. Also this still didn’t resolve the issue. I believe it’s a persistant bug that keeps appearing and with each new version the Unity team says it’s been fixed but it’s not.

Sorry my reply didn’t help, but where did you thought I said rigidbodies?

1 Like

Collision avoidance, not collision detection.

1 Like

@SparrowNest thank you for your time, it’s always nice to see people helping others :slight_smile: And yes for some reason I read it as collision detection.