Search Unity

NavMeshAgent.speed varies depending on animation

Discussion in 'Navigation' started by Tarball, Jan 28, 2018.

  1. Tarball

    Tarball

    Joined:
    Oct 16, 2016
    Posts:
    166
    I'm using the standard assets 3rd person controller with NavMesh for my NPCs, and most are working fine. However, on one of them, which has identical parameters as the others (smart copy/paste asset), the run speed is actually slower than the walk speed... I have the same 2d freeform cartesian blend tree for motion as other NPCs, and only this one is behaving irregularly.

    It seems to run about 5 times too slow. When I set NavMeshAgent.speed = 5, instead of 1, the NPC runs at the correct speed, but now he is walking too fast. I'd give more information, but this has become too large of a project to narrow it down. I'm curious about some examples of what could cause such a thing. Maybe that will help me to narrow it down.

    By the way, the controller uses both root motion and Rigidbody, and the following to control velocity:

    Code (CSharp):
    1.             Vector3 v = (m_Animator.deltaPosition * m_MoveSpeedMultiplier) / Time.deltaTime;
    2.             m_Rigidbody.velocity = v;
    The Rig has a warning: A Biped was detected, but cannot be configured properly because of an unsupported hierarchy.... Could this be the problem? It seems to work for some animations, but speed is off.
     
    Last edited: Jan 29, 2018