Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

MonoBehaviour.OnAnimatorMove()

マニュアルに切り替える

説明

ルートモーションを修正するアニメーション動作を処理するコールバック

このコールバックは各フレームごとにステートマシンおよびアニメーションが評価された後、 OnAnimatorIK が実行される前のタイミングで実行されます。

See Also: Root motion.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnAnimatorMove() { Animator animator = GetComponent<Animator>(); if (animator) { Vector3 newPosition = transform.position; newPosition.z += animator.GetFloat("Runspeed") * Time.deltaTime; transform.position = newPosition; } } }