- Home /
First Person Controller Collision Issues
I have the first person controller and a cube on the terrain in my scene. The box collider is checked on the cube.
I attached the following javascript script to my controller:
function OnCollisionEnter(col: Collision){
print("Collision");
}
For some reason nothing is printed when the controller collides with the cube but the collision works and the controller stops moving.
Answer by robertbu · Mar 07, 2014 at 02:08 AM
Yep. The way to capture that collision is in a script attached to the object with the CharacterController. Then you have to use the OnControllerColliderHit() callback to capture the event.
Wow you are the man! I've been searching online forever for an answer to this question and have found nothing.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135557im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Collision Detection 0 Answers
Stop Object From Ignoring Collisions - Pick Up Rigidbody 0 Answers
Movment of character through Java script 0 Answers
Collision between capsule collider 0 Answers