Modify "Humanoid" Animations
I've created my arms with FPS mesh tool Look at the hierarchy, there's still the normal body bones. I also created a IKArms script to handle correctly my weapon sway effect (love it)
#pragma strict
var animator : Animator;
var ikActive : boolean;
var rightHand : Transform;
var leftHand : Transform;
var rightHandTarget : Transform;
var leftHandTarget : Transform;
var lookTarget : Transform;
/*
var bodyPositionOffset : Vector3;
*/
function OnAnimatorIK () {
//if the IK is active, set the position and rotation directly to the goal.
if(ikActive) {
// Set the look target position, if one has been assigned
if(rightHandTarget != null) {
animator.SetLookAtWeight(1);
animator.SetLookAtPosition(lookTarget.position);
}
// Set the hands target position and rotation, if one has been assigned
animator.SetIKPositionWeight(AvatarIKGoal.RightHand,1);
animator.SetIKRotationWeight(AvatarIKGoal.RightHand,1);
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand,1);
animator.SetIKRotationWeight(AvatarIKGoal.LeftHand,1);
animator.SetIKPosition(AvatarIKGoal.RightHand,rightHandTarget.position);
animator.SetIKRotation(AvatarIKGoal.RightHand,rightHandTarget.rotation);
animator.SetIKPosition(AvatarIKGoal.LeftHand,leftHandTarget.position);
animator.SetIKRotation(AvatarIKGoal.LeftHand,leftHandTarget.rotation);
}else{//if the IK is not active, set the position and rotation of the hands and head back to the original position
animator.SetIKPositionWeight(AvatarIKGoal.RightHand,0);
animator.SetIKRotationWeight(AvatarIKGoal.RightHand,0);
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand,0);
animator.SetIKRotationWeight(AvatarIKGoal.LeftHand,0);
animator.SetLookAtWeight(0);
}
//animator.bodyPosition = animator.bodyPosition + bodyPositionOffset;
}
Simple. The Arms animator does NOT containt ANY animations, because IK does the job very nicely, and i can't create animations with humanoïd things. (sadly...) The IK in action : How can i modify my animations arms without any external program? :)
Your answer
Follow this Question
Related Questions
How to fix the rotation of my IK foot? 2 Answers
Arms Over-Rotate When Using IK While Bending Spine 0 Answers
How do i make a child not rotate with the parent. But i still want to be able to rotate it? (2D) 0 Answers
I think that everything is all right...why it doesnt work correctly? 0 Answers
Javascript error 1 Answer