- Home /
 
Nav Mesh Agent rotating at destination
I am working with nav mesh agent, I have a plane in a 3D world with a baked nav mesh,
I have enemys(Zombies) that follow the player with a nav mehs agent, It is working the problems cames when they is arriving at destination, for some reason they start to rotating ( see image ) ( unity don't let me upload , so I uploaded in an external site)

I tryed to put the Y value of the enemy but It didn't work
   target = GameObject.FindGameObjectWithTag("PlayerTarget").transform;
   Vector3 destination = new Vector3(target.transform.position.x, transform.position.y, target.transform.position.z);
   navMeshAgent.destination = destination;
 
               Any Idea will be welcome
Update fuction
  public void Update()
     {
         float speed = Vector3.Project(navMeshAgent.desiredVelocity, transform.forward).magnitude;
         animator.SetFloat("Speed", speed);
         if (currentEstado != Estado.Death)
         {
             if (target != null)
             {
                 currentEstado = Estado.Running;
                 transform.LookAt(target);
               
                 if (Vector3.Distance(transform.position, target.position) <= navMeshAgent.stoppingDistance)
                 {
                     currentEstado = Estado.Attacking;
                     if (Time.time > nextAttackTime)
                     {
                         Attack();
                         nextAttackTime = Time.time + msBetweenAttacks/1000;
                     }
                     skinMaterial.color = Color.red;
 
                 }
             }
             else
             {
                 currentEstado = Estado.Idle;
             }
 
         }
         AnimarEstado();
     }
 
              Are you using code to rotate the characters to face the player?
That was the issue , Thank you very much! Post an aswer so I can accept it!
Answer by Suduckgames · Mar 06, 2017 at 12:43 PM
I was using LookAt and NavMeshAgent , elimanting the LookAt fuction make it works
Your answer
 
             Follow this Question
Related Questions
NavMeshAgent Rotate With Model 0 Answers
GameObject with NavMeshAgent resets rotation when game starts 2 Answers
NavMeshAgent rotation 2 Answers
Can't make the manual offmeshlink work 1 Answer
Navigation bake doesn´t work. 0 Answers