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

    Holy_light

    Joined:
    Nov 23, 2019
    Posts:
    12
    I am reading https://learn.unity.com/tutorial/pl...65ddedbc2a08d53c7acb#5caf7217edbc2a08d53c87f0
    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
    m_Animator.deltaPosition
    return?

    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
    m_Animator.deltaPosition
    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?

    Thanks!
     
  2. kamran-bigdely

    kamran-bigdely

    Joined:
    Jun 19, 2014
    Posts:
    22
    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.
     
unityunity