Character Controller Collisions Question


When I add a character controller to the player and move to collide with something, OnControllerColliderHit is not invoked..what could be wrong?

public class Object_To_Collide_With : MonoBehaviour {

    private void OnControllerColliderHIt(ControllerColliderHit hit) {
        Debug.Log("OCCH"); //<--never happens
        //ideally, we use hit in the same way as col (below)
    private void OnCollisionEnter(Collision col) {
        Debug.Log("OCE"); //<--Happens
        if (col.gameObject.tag == "Player") {// do stuff
        // This does not work if JUST a character controller 
        // is used as the collider for the player

When the player collides with an object the above script is attached to, the Debug.Log("OCE") is the only statement written to the console.

I don't want to have to add another collider component to the player, e.g. an overlapping capsule collider. Why does the above condition in OCE never happen/occur without a capsule, box, or sphere collider attached to the player?

I suspect that you might need to add a rigidbody to either your playercapsule OR to your level object.

Try attaching a rigidbody component to the object you bump into. If you want the object to be solid & never move, make sure you set the Kinematic property (true) in the inspector.