Version: 2020.3
言語: 日本語
public float moveLength ;

説明

コライダーにヒットするまでに、キャラクターがどのくらいの距離を移動したか。

Note that this can be different from what you pass to CharacterController.Move, because the initial movement vector is decomposed into a set of movements, according to CharacterController.stepOffset.

See Also: ControllerColliderHit.moveDirection.

using UnityEngine;

public class ExampleClass : MonoBehaviour { void OnControllerColliderHit(ControllerColliderHit hit) { Debug.Log(hit.moveLength); } }