#StackBounty: Why are multiple Nav Mesh Agents jittery when the target is inaccessible?

Bounty: 50

I have a simple scene. Most of the land is flat, except for three raised cylindrical platforms coming up from the ground. I have several enemies with Nav Mesh Agent components attached, with their target being the player. I used the Standard Assets’ ThirdPersonCharacter script, and then called character.Move(agent.desiredVelocity, false, false); within the Update() of a character control script.

The agents work great when the player runs around on the ground. When the player hops on the platform (about 2 units above the ground), an agent will walk toward the edge of the platform and then stop, just as expected. However, if I throw in a second agent, both agents work fine only until the player stands on the platform. Then they start to jitter, like they cannot make up their minds on whether to turn left or right when they should really just walk straight. If I add even more agents, the jittering gets worse. With enough, they don’t even move forward and simply turn left and right rapidly.

Clearly, there is a problem with interference, and I understand the agents are designed to avoid obstacles as well as each other, but here is what I found and tried so far:

  • I switched the obstacle avoidance quality to None. The jitter still happens just as much.
  • Some other posts suggested setting IsKinematic to true for moving obstacles. I cannot do this because the character script depends on the rigidbody not being kinematic.
  • I adjusted the height of the platform and re-baked the navmesh. It had no effect. It must be the fact that the platform is not actually accessible, so that the agents can only make a partial path.
  • I messed with the pathfinding settings on the agent, such as turning auto repath off, since it has to do with partial paths. There were no noticeable changes.

Does anyone know what might be causing the jitters and how I could fix this?

Update

As requested, here is how my Nav Mesh agent is configured:
Nav Mesh Agent Inspector


Get this bounty!!!

Leave a Reply