IK動畫
IK動畫直接we位置的匹配。
尋找定位點
勾選層中的IK pass
//每幀都執行
private void OnAnimatorIK(int layerIndex)
{
if (layerIndex == 1)
{
int houldLogWeight=anim.GetBool(isHoldLogID)?1:0;
//當前是被holdlog這一層呼叫的
anim.SetIKPosition(AvatarIKGoal.LeftHand, leftHand.position);
anim.SetIKPositionWeight(AvatarIKGoal.LeftHand, houldLogWeight);
anim.SetIKRotation(AvatarIKGoal.LeftHand, leftHand.rotation);
anim.SetIKRotationWeight(AvatarIKGoal.LeftHand, houldLogWeight);
//設定右手
anim.SetIKPosition(AvatarIKGoal.RightHand, rightHand.position);
anim.SetIKPositionWeight(AvatarIKGoal.RightHand, houldLogWeight);
anim.SetIKRotation(AvatarIKGoal.RightHand, rightHand.rotation);
anim.SetIKRotationWeight(AvatarIKGoal.RightHand, houldLogWeight);
}
}