Search Unity

Where does navigation ends?

Discussion in 'Navigation' started by nagyv, Feb 28, 2017.

  1. nagyv

    nagyv

    Joined:
    Dec 22, 2016
    Posts:
    4
    The following two parts of code:

    Code (csharp):
    1.  
    2.  public void moveTo(Vector3 position, string tatami_name) {
    3.         moving = true;
    4.         Debug.Log ("moving to: " + position.x + ", " + position.y);
    5.         agent.destination = position;
    6.     }
    7.  
    8. void Update () {
    9.         if (!agent.pathPending && moving)
    10.         {
    11.             if (agent.remainingDistance <= agent.stoppingDistance)
    12.             {
    13.                 if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f)
    14.                 {
    15.                     Debug.Log ("stopped at: " + transform.position.x + ", " + transform.position.y);
    16.                 }
    17.             }
    18.         }
    19.     }
    20.  
    Log that:

    Code (csharp):
    1.  
    2. moving to: 2, -0.5
    3. stopped at: 2, 0.00333333
    4.