Having a kinematic rigidbody detect collision with a collider without a rigidbody

Is it possible to have a kinematic rigidbody detect when it has collided with another collider that does not have a rigidbody? (Are these static colliders)?

OnCollisionEnter does not seem to trigger

Yes, you can achieve the effect that you want by make it not kinematic rigidbody and checking all the constraints for freeze position and freeze rotation. This way your rigidbody is not effected by physics but can still detect collision with OnCollisionEnter(Collision c), OnCollisionStay(Collision c) and OnCollisionExit(Collision c)

In 2017, Unity added the “Contacts Generation” setting in your Project Settings > Physics menu.

You can set this to “Enable Kinematic Static Pairs” to allow kinematic rigidbodies to get callbacks on collisions with static colliders.

115357-cd50b4078465a59fe047027c6a624f99.png

No, it’s not possible to have a kinematic rigidbody detect collisions with static colliders. Look it up in the manual- there’s this nice little chart down the bottom that explains all of this.

It isn’t directly possible, no.

But if you put another game object under the kinematic rigidbody that contains a trigger with the exact same collider as the parent and a kinematic rigidbody of its own, the trigger will (in theory) receive trigger messages from whatever they hit since they’ll always be in the same position.

I have never actually tried this so it might not work if unity decides it doesn’t feel like it.

I had success to get a collision (hit point, normal etc) with a kinematic rigidbody with a trigger collider with the static world collider.

I was using OnCollisionEnter but that only gave me the collider, not the hit point & normal. Because I was moving the kinematic rigidbody, before I moved it in FixedUpdate I used Rigidbody.Sweep which gives has an out for RaycastHit.

In my tests this gave the same result as the non-kinematic non-trigger rigidbody colliding with the world.

Another alternative would be something like Physics.checksphere (radius) which returns a boolean depending on if it collides with something within a certain radius.

kinematic rigidbody checks all the constraints for freeze position and freeze rotation. This way a rigidbody is not effected by physics but can still detect collision with OnCollisionEnter syntax