- Home /
NavMesh Fidgeting
I created a gameObject, and used Navmesh. the Navmesh is working fine, but as it is coming towards the target, it keeps on fidgeting like crazy. It isn't rotating, but it just keeps shifting around. Is there anything that I can do to stop it from doing so?
That isn't normal Nav$$anonymous$$esh behavior what code have you got so we can see if something being passed to the navmesh agent that's causing it.
using UnityEngine;
using System.Collections;
public class SampleAgent : $$anonymous$$onoBehaviour {
public Transform target;
Nav$$anonymous$$eshAgent agent;
// Use this for initialization
void Start () {
agent = GetComponent<Nav$$anonymous$$eshAgent> ();
}
// Update is called once per frame
void Update () {
agent.SetDestination (target.position);
}
}
Could it also be because I added a Rigidbody?
Answer by jpthek9 · Jan 03, 2015 at 10:11 PM
Make sure you take off your rigidBody or if you need one for collision detection, check every single constraint. That way your character's movement isn't affected by 2 seperate controllers trying to get it to what they think is the correct position. What's probably happening is your character's rigidBody wants to pull it down with gravity but the navmesh controller doesn't.
Thanks, but I'm relatively new, and so I did not get what you just said. I'm also trying to use a Hover $$anonymous$$otor sort of thing, so is there a way to let me use Rigidbody only for collision and gravity, and have navmesh not affect those two?
Yes! Don't worry about gravity or physics collisions - the Nav$$anonymous$$esh will keep you stuck to the ground. On your character, look for the Rigidbody component. There should be something that says 'Use Gravity'. Uncheck that then look for the 'Constraints' section of the rigidbody. Check everything. Now you're good!
Answer by ThomasMarsh · Jan 04, 2015 at 01:42 AM
I was having a similar issue and I found that making the NavMesh itself smoother by messing with the bake settings, decreasing the radius of the NavMeshAgent (in the properties of the NavMeshAgent component), and removing any physics colliders from the object the NavMeshAgent is in improved the smoothness of the navigation.
Your answer
![](https://koobas.hobune.stream/wayback/20220613175525im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 3.5: Is there a way to access a NavMeshAgent's current path? 1 Answer
Navmesh Teleporting (With Server) 1 Answer
How to sample a point on a navMesh Agent path 0 Answers
Nav Mesh Agent 1 Answer