Destorying an object when it hits the ground

Hi, I’m trying to get my projectile “Shell” to be destroyed both when it hits the opponent, and if it misses and hits the floor. As it is now, it does print out but doesn’t get destroyed. I’m sure I overlooked something small or put something in the wrong place. Any help would be appreciated!

	function OnCollisionEnter(collision : Collision)
{
print( "floor");
    if (collision.gameObject.tag == "Shell")
    {
        Destroy(gameObject);
    }
}

First of all, I’d add this script to the shell, not the floor. Let each shell check ‘am I hitting the floor’ and not the floor ‘am I being hit by a shell’. I’m not sure, but I could imagine that if two shells enter collision with it during the same frame, only one will get destroyed. It would also seem that in the script you posted you’re destroying the floor, not the Shell. Or you’re checking the shell, not the floor - it’s hard to know what if I don’t know if the script is attached to the floor or the shell.

This is how I would do it. Attach this script to the shell and tag the floor “Floor”.

function OnCollisionEnter(col : Collision) {
    if (col.gameObject.tag == "Floor") {
        Destroy(gameObject);
    }
}