title: Unity fix NavMeshAgent jerky movements?
body: <blockquote>
  <p>Record of the problem</p>
  </blockquote>
  <p><a href="https://youtu.be/BpzHQkVQz5A" rel="nofollow noreferrer">https://youtu.be/BpzHQkVQz5A</a></p>
  <blockquote>
  <p>Explaining my problem</p>
  </blockquote>
  <p>I'm programming a mobile game using Unity3D Engine. For my player movement, I'm using NavMeshAgent because it's for me the easiest and most efficient way to do it. But when I hit the play button and ask my player to move, the movements are jerky and it's not pleasant to see at all.</p>
  <p>Do you have any idea to fix this problem ?!
  Thank you in advance for your answers ! ^^</p>
  <blockquote>
  <p>My code</p>
  </blockquote>
  <p>This is my code :</p>
  <blockquote>
  <p>Player.cs</p>
  </blockquote>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.AI;
  
  public class Player : MonoBehaviour
  {
      NavMeshAgent agent;
      Touch touch;
      RaycastHit hit;
      Ray ray;
  
      // START FUNCTION
      private void Start()
      {
          agent = GetComponent&lt;NavMeshAgent&gt;();
      }
  
      // UPDATE FUNCTION
      private void Update()
      {
          // TOUCH DETECTION
          if (Input.touchCount &gt; 0)
          {
              touch = Input.GetTouch(0);
  
              // A FINGER TOUCHED THE SCREEN
              if (touch.phase == TouchPhase.Began)
              {
                  // RETURN X, Y AND Z WORLD POS OF THE TOUCH SCREEN POS
                  ray = Camera.main.ScreenPointToRay(touch.position);
  
                  if (Physics.Raycast(ray, out hit))
                  {
                      if (hit.collider != null)
                      {
                          // MOVING PLAYER TO THE HIT POS
                          Vector3 hitVec = new Vector3(hit.point.x, hit.point.y + (GetComponent&lt;Collider&gt;().bounds.size.y / 2), hit.point.z);
                          agent.SetDestination(hitVec);
                      }
                  }
              }
          }
  
          // SAME CODE USING MOUSE BUTTON
  #if UNITY_EDITOR
  
          if (Input.GetMouseButton(0))
          {
              ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  
              if (Physics.Raycast(ray, out hit))
              {
                  if (hit.collider != null)
                  {
                      Vector3 hitVec = new Vector3(hit.point.x, hit.point.y + (GetComponent&lt;Collider&gt;().bounds.size.y / 2), hit.point.z);
                      agent.SetDestination(hitVec);
                  }
              }
          }
  
  #endif
      }
  }</code></pre>
  </div>
  </div>
  </p>
  <blockquote>
  <p>CameraFollow.cs</p>
  </blockquote>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  // BRACKEYS CAMERA FOLLOW SCRIPT WITHOUT THE LOOKAT METHODE
  public class CameraFollow : MonoBehaviour
  {
      public Transform target;
  
      public float smoothSpeed = 0.2f;
      public Vector3 offset;
  
      void FixedUpdate()
      {
          Vector3 desiredPosition = target.position + offset;
          Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);
          transform.position = smoothedPosition;
      }
  }</code></pre>
  </div>
  </div>
  </p>