Question by
tommah · Feb 27, 2019 at 03:19 PM ·
rigginghumanoidinverse kinematic
Arm IK avoid body
I am running into an issue of trying to apply IK to the left arm but the left arm is clipping through the body, is there anyway to avoid this and have the arm wrap around the body more naturally? The arm looks even worse from the back. I've tried editing the Muscle Settings but once the IK takes effects it seems to ignore the settings.
Here is the arm ik code
void OnAnimatorIK()
{
if (!animator)
return;
if (currentWeapon && currentWeapon.userSettings.leftHandIKTarget) {
animator.SetIKPositionWeight (AvatarIKGoal.LeftHand, 1);
animator.SetIKRotationWeight (AvatarIKGoal.LeftHand, 1);
Transform target = currentWeapon.userSettings.leftHandIKTarget;
Vector3 targetPos = target.position;
Quaternion targetRot = target.rotation;
animator.SetIKPosition (AvatarIKGoal.LeftHand, targetPos);
animator.SetIKRotation (AvatarIKGoal.LeftHand, targetRot);
} else {
animator.SetIKPositionWeight (AvatarIKGoal.LeftHand, 0);
animator.SetIKRotationWeight (AvatarIKGoal.LeftHand, 0);
}
}
ikissue.jpg
(45.3 kB)
ikissue2.jpg
(18.5 kB)
Comment