Easy collision script not working, don't understand.

So I have this plane which i control around and i want it to destroy itself when it hits the ground, so once i don’t want it do destroy imidiatly just for being on the ground i added a sphere collider empty object in front of the nose (i’m thinking addind two on the wings later) and i added this simple script to that:

#pragma strict
function OnCollisionEnter(col : Collision)
            col.gameObject.SendMessageUpwards("DestroyPlane", SendMessageOptions.DontRequireReceiver);

I then parented the plane to this tiny object and added this code to the plane control script itself:

function DestroyPlane() {


But for some reason i don’t know why the plane doesn’t destroy itself when the collider hits anything… :\

Am i missing something? Cause I can’t figure out what how can the script be wrong…

From documentation (Unity - Scripting API: Collider.OnCollisionEnter(Collision)).

“Note that collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached.”

Are you missing a rigidbody? Also, if the sphere collider that should trigger the destruction of the object is too small then the physics engine may miss the collision (can occur if the object “would” have collided between frames).

That’s correct, i was ,missing the rigid body, not it works as it was supposed to… Thank you. :wink: