- Home /
Collision detection on 2 object with colliders.
I have 2 gameObjects and both have colliders. Is it possible to detect collision without making it rigid body?
In the documentation it says "OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider"
But when i try this function without making the gameObject a rigid body it doesn't run.
function OnCollisionEnter(collision : Collision) {
print(collision.gameObject);
}
Comment
Answer by Paprik · Jul 24, 2014 at 09:59 AM
Unity is weird in this. If neither object has a rigidbody it's not guaranteed to work. So if you absolutely can't use a rigidbody, you're going to have to create your own detection function.
There's a pretty lengthy discussion here: Collision checking without the need of a rigidbody.