Version: 2018.2
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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961