Search Unity

Navigation Agent Gets Stuck on Navmesh Corner No Matter What, bug?

Discussion in 'Navigation' started by BitMax, Dec 3, 2018.

  1. BitMax

    BitMax

    Joined:
    Apr 11, 2013
    Posts:
    4
    Hey guys, I've been using Unity for years and specifically it's built in navigation on occasion but have yet to come across something like this.

    In a nutshell, my navigation agent on game start moves blazingly fast to the edge of the navmesh and stays there, always to the same corner even if I rotate the box I use and rebake the navmesh.

    The set up I have is the most bare bones it can be, just a box as floor with baked navmesh, with an agent cube on top of it. Also I've put a destination object and a script on the agent that looks like this:



    Code (CSharp):
    1.  public class walktst : MonoBehaviour {
    2.      public GameObject destination;
    3.      private UnityEngine.AI.NavMeshAgent agent;
    4.      // Use this for initialization
    5.      void Start () {
    6.          agent = GetComponent<UnityEngine.AI.NavMeshAgent>();
    7.      }
    8.    
    9.      // Update is called once per frame
    10.      void Update () {
    11.          agent.Move(destination.transform.position));
    12.      }
    13. }
    All other settings are at their default values.

    I'd absolutely love some input on this, is this a bug or something?


    EDIT-Solved
    Should have used agent.SetDestination(). Thread can be removed by the mods. Thanks.
     
    Last edited: Dec 3, 2018