Search Unity

Question animator position control

Discussion in 'Animation' started by Zimaell, May 15, 2023.

  1. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    409
    Why when you set the same coordinates in the animator, they change visually?

    that is, I set the following code and visually it is clear that the location of the legs and their rotation are changing.

    Code (CSharp):
    1. animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1f);
    2. animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, 1f);
    3. animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, 1f);
    4. animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, 1f);
    5. animator.SetIKPosition(AvatarIKGoal.LeftFoot, animator.GetIKPosition(AvatarIKGoal.LeftFoot));
    6. animator.SetIKPosition(AvatarIKGoal.RightFoot, animator.GetIKPosition(AvatarIKGoal.RightFoot));
    7. animator.SetIKRotation(AvatarIKGoal.LeftFoot, animator.GetIKRotation(AvatarIKGoal.LeftFoot));
    8. animator.SetIKRotation(AvatarIKGoal.RightFoot, animator.GetIKRotation(AvatarIKGoal.RightFoot));