- Home /
Detecting collision between Character Controller and Rigidbody/Sphere Collider
I have a character object with a Character Controller and a normal game object with both Rigidbody and Sphere Collider components. The Rigidbody is non-kinesmatic and the Sphere Collider is not a trigger.
When my character hits the game object, I should get an OnCollisionEnter call, right? But I'm not -- I've got a Debug.Log message printing in the OnCollisionEnter method of a script attached to the game object, but it never shows up.
For comparison, the collision gets detected if I make the Sphere Collider a trigger and use OnTriggerEnter instead.
What am I doing wrong?
Answer by sparkzbarca · Oct 13, 2012 at 01:42 AM
its kinds of wierd the way Char colliders and rigid bodies collide long story short
if the rigidbody is in motion a.k.a not sleeping which it is sleeping if its not moving then it works if the rigidbody isnt moving it doesnt
so player hits gameobject fail gameobject hits player works
you can use oncharactercolliderenter (thingthatihit) if (thingthatihit.tag = "wall") { do that thing you do }
Thanks. Good to know, enough though that's unfortunate behavior. (Is it documented somewhere?) Anyhow, I decided to keep the collision logic in the game object by creating a separate Sphere Collider as a trigger and using OnTriggerEnter (with the original, slightly smaller non-trigger Sphere Collider still there to prevent the user from moving over the object).
Your answer
![](https://koobas.hobune.stream/wayback/20220613082248im_/https://answers.unity.com/themes/thub/images/avi.jpg)