- Home /
collision with character controller
Hi!
I have a problem that i can not get over with and could not find answe anywhere.
I've got a character controller on my player and i would like to detect the collision with an object. I put a box collider on the object and trying to detect the collision with the OnCollisionEnter function.
However, i just can not reach the collider with my character controller and i think it is because of the skin width property of the character controller. I can see in scene view that the controller and the box collider can not reach each other because of it. If i decrease the skin width it they can move closer but cant collide.
So the question is: how can i detect this kind of collisions?
Thanks in advance!
Answer by robertbu · May 07, 2014 at 03:38 PM
You cannot detect a collision with a CharacterController using OnCollisionEnter. You can use the OnControllerColliderHit() callback, but the script must be on the CharacterController object.
Thanks, I am disappointed because this needs a little workaround but at least it is possible
Your answer
![](https://koobas.hobune.stream/wayback/20220613144445im_/https://answers.unity.com/themes/thub/images/avi.jpg)