Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

What does Animator.deltaPosition return?

Discussion in 'Animation' started by Holy_light, May 20, 2020.

  1. Holy_light


    Nov 23, 2019
    I am reading
    and there is a method:
    Code (CSharp):
    1.     void OnAnimatorMove ()
    2.     {
    3.         m_Rigidbody.MovePosition (m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude);
    4.         m_Rigidbody.MoveRotation (m_Rotation);
    5.     }
    I think, this method is to change the location of the character, but what does

    It is said that it "Gets the avatar delta position for the last evaluated frame.", but the position doesn't change, so does it return zero?

    The reason why the position doesn't change is that the
    OnAnimatorMove ()
    method is to change the character's location as mentioned above, so
    cannot also change the location, because you cannot change the location twice, is that correct?

    In general, does Animator change location of the game object to which it is attached?

    In my opinion, for example, Animator only moves the arms and legs of a character, but never changes the location of the character as a whole, is that right?

  2. kamran-bigdely


    Jun 19, 2014
    m_Animator.deltaPosition returns the character movement that the artist has designed in the walking animation. So if the artist has made the walking animation such that the character walks on the spot, deltaPositin returns zero.

    Watch the animation clip in Unity and see whether your character actually moves its position (and not just moving its body part faking walking forward).

    To fix it, you would have to open the animation file in Blender or may and modified it there.