2
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Could you please show the settings of the navmesh and navmeshAgent with the code you are using to move units with navmeshAgent? So we could recreate this on our devices or see if the problem lies in the code. \$\endgroup\$ – Candid Moon _Max_ Feb 16 '17 at 16:31
  • \$\begingroup\$ @CandidMoon, I added a screenshot of the inspector for the Nav Mesh Agent. I haven't made any significant changes to the Standard Assets' ThirdPersonCharacter and AIThirdPersonController scripts, so assume I am using those. \$\endgroup\$ – tyjkenn Feb 16 '17 at 17:54
2
\$\begingroup\$

I had this problem and I was messing around with the Nav Mesh Agent and found out turning off "Auto Braking" fixed the problem. enter image description here

\$\endgroup\$
  • \$\begingroup\$ The Stopping Distance may need increased slightly as well. \$\endgroup\$ – Chad Mar 14 '18 at 15:24
0
\$\begingroup\$

Try setting the priority of all the Agents very low, except one, and see if this exact Agent is also facing the same issue as the others. To me it sounds like the agents were constantly trying to find a new path, as the other agents get too close.

\$\endgroup\$
  • \$\begingroup\$ It tried this. It didn't change anything for any of the agents. However, strangely enough, the glitch became less frequent when I made a slope to one of the platforms, even when I would stand on the other slope-less platforms. \$\endgroup\$ – tyjkenn Feb 16 '17 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.