public float leftFootPositionWeight;
public float leftFootRotationWeight;//定义一个物体影响左脚旋转的权重
public Transform leftFootObj;//定义一个物体影响左脚位置的权重
private Animator animator;//定义一个animator
void Start() {
animator = GetComponent<Animator>();
}
void OnAnimatorIK(int layerIndex) {
animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, leftFootPositionWeight);
animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, leftFootRotationWeight);
animator.SetIKPosition(AvatarIKGoal.LeftFoot, leftFootObj.position);
animator.SetIKRotation(AvatarIKGoal.LeftFoot, leftFootObj.rotation);
}
这是一段通用代码,可以直接使用。
实例:https://www.u3dc.com/?p=448
打赏
扫一扫,请博主喝杯咖啡~