Unity - 简单的IK实现-OnAnimatorIK
Unity OnAnimatorIK提供了简单IK的实现方式。
准备:
- Model的Animation Type设置为Humanoid。
- 检测Avatar是否有异常。
- Animator勾选IK Pass。
准备好之后,挂载的MonoBehaviour的OnAnimatorIK才会被回调。
代码:
public class IKTest : MonoBehaviour
{
[Range(0, 1)]
// IK权重
public float weight = 1;
// IK跟随的物体
public Transform rightHandFollowObj;
public Transform leftHandFollowObj;