Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feature Request Possible to retrieve local avoidance velocity from NavMeshAgent without SetDestination

Discussion in 'Navigation' started by FoodFish_, Jun 28, 2023.

  1. FoodFish_

    FoodFish_

    Joined:
    May 3, 2018
    Posts:
    58
  2. FoodFish_

    FoodFish_

    Joined:
    May 3, 2018
    Posts:
    58
    Currently, when assigning the velocity manually, we have to rule out local avoidance completely and this is a real problem:


    public void Update()
    {
    Assert(CharacterObject.Kinematics != null, $"{CharacterObject.Name} missing its kinematics component.", true);
    _navMeshAgent.transform.position = _characterObject.Position;
    _navMeshAgent.velocity = _characterObject.Kinematics.Motor.Velocity;
    }