Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[SOLVED] IK hand not reaching target anymore

Discussion in 'Scripting' started by _FLX, Aug 28, 2017.

  1. _FLX

    _FLX

    Joined:
    Nov 10, 2015
    Posts:
    85
    Hi,
    I'm using SetIKPosition / Rotation to place a character hands on a gun. (Each hand tracking it's own point)
    This was working exactly has intended, but I recently updated to Unity 2017.10f3 and noticed that there was now an offset between the hands and their target points.

    These points are still at the right place, and IKPositionWeight (and rotation weight) are 1.

    Do you know if this is a known bug, or something that changed in a recent update ?


    Here is an example code for the right hand :

    Code (CSharp):
    1.  
    2.     private void RightHandUpdate() {
    3.         if(_currentRightHandWeight != rightHandWeight) _currentRightHandWeight = Mathf.MoveTowards(_currentRightHandWeight, rightHandWeight, 0.7f);
    4.         animator.SetIKPositionWeight(AvatarIKGoal.RightHand, _currentRightHandWeight);
    5.         animator.SetIKRotationWeight(AvatarIKGoal.RightHand, _currentRightHandWeight);
    6.         animator.SetIKPosition(AvatarIKGoal.RightHand, rightHandTarget.position);
    7.         animator.SetIKRotation(AvatarIKGoal.RightHand, rightHandTarget.rotation);
    8.     }

    Here is a picture : you can clearly see the difference between the hand and the selected target point.
    unitybug.png

    I forgot to say that I updated to Windows 10 and made a fresh install of everything.
     
    Last edited: Aug 28, 2017
  2. _FLX

    _FLX

    Joined:
    Nov 10, 2015
    Posts:
    85
    Ok my bad.
    I tried to make a custom ragdoll by overriding mecanim and OnAnimatorIK in LateUpdate.
    This was the cause of that IK offset, everything is good when I disable it.