Unity collision bounces off, but no OnCollisionEnter

I have a problem with Unity collision system.

I’m trying to add some 3d objects(rocks) to my scene with mesh collider(convex mesh collider ticked), but no rigidbody. I have a bullet prefab with rigidbody and sphere collider. I attached a script to the bullet prefab, that OnCollisionEnter it should destroy the bullet prefab and play an explosion particle.

Now the problem is that when I shoot the bullet towards the 3d object (rock) it bounces off instead of exploding( aka no OnCollisionEnter called). With other colliders like box, capsule or terrain collider it works just fine.

I tried to add a rigidbody to it, after which it starts working, OnCollisionEnter is called and the bullet explodes, but the problem with this is that I can move the 3d object with physics which I shouldn’t be able to.

To solve this i tried to constraint in the inspector the position and rotation, which I thought solved my problem, because the bullet explodes on contact and the 3d object won’t move, but now my other problem is that I can walk through the object…

Edit: I tried IsKinematic, same rule applies, bullet bounces off, but no OnCollisionEnter called.

Any idea how to solve my problem? So that I would have a 3d object with meshcollider calling OnCollisionEnter on contact with a sphere collider, but not letting me pass trough it?

It works in a sample project and not on the main project, it seems I need to figure it out what happens…

Firstly, be careful with Unity collision detection and fast moving objects like bullets. It’s very easy to see some quantum tunneling effects where objects pass through each other between FixedUpdates.

Secondly, the Unity docs state that OnCollisionEnter will only be triggered if one of the colliding objects also has a non-kinematic rigidbody attached. You could make the rocks rigidbody’s I guess but that’s probably not what you’re looking for.

I suggest you use Physics.Raycast or Physics.SphereCast (or similar) to do your bullet collision detection by casting a ray between the previous and current bullet position each FixedUpdate. This should ensure you don’t miss any collisions, that you can handle them however you like (explosion etc), and is probably more efficient than having a collider on the bullet itself.

Check out this commonly referenced script to point you in the right direction:
http://wiki.unity3d.com/index.php?title=DontGoThroughThings

I found out what’s causing the problem. I set the sphere collider radios way too small (0.025 instead of 0.5, dunno how xD my fault)and for some strange reason with dynamic continuous physics it was detecting collision but no event raised… only when collided with terrain or basic shapes… It’s an interesting behavior, but at least now I know what did I do wrong.