- Home /
Collision detection when no collision happens,OnCollision is called without a collision
Hello,
I am new to Unity and trying to create a simple game. I have created an obstacle object which has hole on it by using ProBuilder. I am trying to move my main object through the holes of this object. My main object has non-kinematic rigidbody with a convex mesh collider and the obstacle object has kinematic rigidbody with a non-convex mesh collider. If I don't use OnCollisionEnter function I can clearly see that the object goes through holes without collision and hits the wall if there are not any holes. The problem is when I use OnCollisionEnter function it cathches collision even when the object passes through the holes. Is there any solution that OnCollisionEnter function only catches real collisions?
Thank you.
Answer by unity_vyvb-GSfngIBrQ · Nov 12, 2021 at 11:31 AM
I had the same issue, a sphere with a rb and sphere collider had to pass though a hole of a gameobject wich have a non-convex mesh collider I have just put the rigidbody of the player on "Continuous dynamic" in detection mode