How far the character has travelled until it hit the collider.
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.
#pragma strict function OnControllerColliderHit(hit: ControllerColliderHit) { Debug.Log(hit.moveLength); }
using UnityEngine;
public class ExampleClass : MonoBehaviour { void OnControllerColliderHit(ControllerColliderHit hit) { Debug.Log(hit.moveLength); } }
Did you find this page useful? Please give it a rating: