Version: 2019.4
public void SetIKRotationWeight (AvatarIKGoal goal, float value);

パラメーター

goal設定した AvatarIKGoal
value回転のウェイト

説明

IK ゴールの移転したウェイトをセットします( 0 = IK 前の元のアニメーション位置、1 = ゴール位置)

IK ゴールは特定のボディパーツのターゲット位置および回転です。Unity により開始位置からパーツをターゲットに向けて移動する方法を計算できます(すなわちアニメーションから取得された現在の位置および回転)。

この関数によりスタートからゴールの間のどこを IK が目指すかを示す 0 から 1 の範囲のウェイト値をセットします。位置そのものは SetIKRotation を使用して別にセットされます。

using UnityEngine;

public class Example : MonoBehaviour { Transform objToAimAt; Animator animator;

void Start() { animator = GetComponent<Animator>(); }

void OnAnimatorIK(int layerIndex) { Quaternion handRotation = Quaternion.LookRotation(objToAimAt.position - transform.position); animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 1.0f); animator.SetIKRotation(AvatarIKGoal.RightHand, handRotation); } }