Version: 5.5

パラメーター

layerIndex IK ソルバーが呼び出されたレイヤーのインデックス

説明

アニメーション IK (インバースキネマティクス)をセットアップするときのコールバック

OnAnimatorIK() は Animator コンポーネントが内部 IK システムを更新する直前により呼び出されます。このコールバックは IK Goal のポジションおよび関連する Weight (重み付け) を設定するために使用することができます。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float leftFootPositionWeight; public float leftFootRotationWeight; public 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); } }