Animation Rigging IK Jitter/Shaking WITH VIDEO

I’m using a two bone IK Constraint in the Unity Animation Rigging package (ver. 1.0.3) to position my arm on a gun. See the YouTube video link if you want to see the jitter:

A couple things to note here:

  1. the gun is not moving, so the IK target isn’t either.
  2. this object is having root motion applied to it via fixedUpdate, however, even when using regular root motion, or not having any root motion at all, this issue is still there.
  3. when I apply an avatar mask that does not animate the arms, the issue is still there, so I do not believe that the base animation is the problem here. I have also tried setting the animator speed to 0 and still get jitter.

Thanks in advance for your help

The solution was that the character was too far away from world 0

1 Like

Check your characters overall scale, I had a problem where my character was physically jittering like that at 0.1 scale, so I increased the scale to 0.2 and it stops the jittering. Something about having smaller scale characters makes the subtle movements of animations more pronounced for some reason, maybe a floating point accuracy thing but i’m not sure.

“maybe a floating point accuracy thing”

I’m pretty sure this is it. Also the scale was 1 in my video. Regardless I’m sure that can be another problem with it.

Another problem I ran into was from using a humanoid avatar, and not also assigning the hand targets using OnAnimatorIK(). I made a script that manages the weight of the humanoid IK to match the weight of the Animation Rigging IK. That fixed a “sliding” problem with my IKs that made it look like the hands were not fully reaching their IK targets (this was not part of the original problem just thought I’d put it here).

Here’s the code:

[Header("OnAnimatorIK")]
        public Rig rightArmRig;
        public Rig leftArmRig;
        public bool disableRightHand;
        public bool disableLeftHand;
        TwoBoneIKConstraint rightArmConstraint;
        TwoBoneIKConstraint leftArmConstraint;
        private void OnAnimatorIK(int layerIndex)
        {
            if (!weaponLoadout.equippedWeapon) { return; }

            if (disableRightHand)
            {
                animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 0);
                animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 0);
            }
            else
            {
                animator.SetIKPositionWeight(AvatarIKGoal.RightHand, rightArmRig.weight * rightArmConstraint.weight);
                animator.SetIKRotationWeight(AvatarIKGoal.RightHand, rightArmRig.weight * rightArmConstraint.weight);
                animator.SetIKPosition(AvatarIKGoal.RightHand, weaponLoadout.equippedWeapon.rightHandGrip.position);
                animator.SetIKRotation(AvatarIKGoal.RightHand, weaponLoadout.equippedWeapon.rightHandGrip.rotation * Quaternion.Euler(-90, 0, 0));
            }

            if (disableLeftHand)
            {
                animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0);
                animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 0);
            }
            else
            {
                animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, leftArmRig.weight * leftArmConstraint.weight);
                animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, leftArmRig.weight * leftArmConstraint.weight);
                animator.SetIKPosition(AvatarIKGoal.LeftHand, weaponLoadout.equippedWeapon.leftHandGrip.position);
                animator.SetIKRotation(AvatarIKGoal.LeftHand, weaponLoadout.equippedWeapon.leftHandGrip.rotation * Quaternion.Euler(-90, 0, 0));
            }
        }
1 Like