Parameters

layerIndex调用反向动力学解算器的层的索引。

Description

用于设置动画 IK(反向运动学)的回调。

OnAnimatorIK() 在即将更新其内部反向动力学系统前由动画器组件调用。该回调可用于设置反向动力学目标的位置及其各自的权重。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { float leftFootPositionWeight; float leftFootRotationWeight; Transform leftFootObj;

private 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); } }