title: NavMesh Agent override rotation
body: <p>I have enemies that patrol to different waypoints using <code>NavMesh Agent</code> I want when the enemy reach the next waypoint to have the same rotation as that waypoint.
  Here is the code:</p>
  
  <pre><code>void Update ()
  {
      if (agent.remainingDistance &lt; 0.1)
          {
              // tried to stop the agent so I can override it's rotation, doesn't work
              agent.Stop();
              // Give him the desired rotation
              transform.rotation = wayPoints[curretPoint].rotation;
  
              if (curretPoint &lt; wayPoints.Length -1)
              {
                  curretPoint++;
              }
              else 
              {
                  curretPoint = 0;
              }
              // make him wait for a fixed amount of time
              patrolTimer += Time.deltaTime;
              if (patrolTimer &gt;= patrolWait)
              {
                  patrolTimer = 0;
                  agent.SetDestination (wayPoints[curretPoint].position);
                  agent.Resume ();
              }
          }
  }
  </code></pre>
  
  <p>The problem is that he keeps rotating back and forth very quickly, I can't get teh desired effect that I want. </p>