SetIKPosition

Hi,

I have a rigged model and have an item they are holding. The item has 2 transforms parented to it, one for the left hand and one for the right hand.

I use the following code

public void OnAnimatorIK()
    {
        UpdateHand(selectedItem, AvatarIKGoal.RightHand);
        UpdateHand(selectedItem, AvatarIKGoal.LeftHand);
    }

    public void UpdateHand(ISelectableItem item, AvatarIKGoal hand)
    {
        if (item != null && !dead)
        {
            animator.SetIKPositionWeight(hand, 1);
            animator.SetIKRotationWeight(hand, 1);

            if (hand == AvatarIKGoal.RightHand)
            {
                 animator.SetIKPosition(hand, item.GetHandPosition(true));
            }
            else
            {
                 animator.SetIKPosition(hand, item.GetHandPosition(false));
            }

        }
        else
        {
            animator.SetIKPositionWeight(hand, 0);
            animator.SetIKRotationWeight(hand, 0);
            //animator.SetIKRotation(AvatarIKGoal.LeftHand, gunpoint.rotation);
        }
    }

However, depending on the position of the item the hands move to different positions on it, despite the transforms on the item not moving relative to it.

I am not that great with the animation stuff so I am guessing I have done something stupid, but I am not sure what it is!

Thanks for any help.

Nothing there looks wrong. What does your GetHandPosition method look like?