Missile firing but no explosion!

Hi guys, this might be a wide question or hard to answer without looking at it. but im making FPS game (which i had no idea what i was doing last week) but now its working gud. my gun its firing bullets (missiles) etc but there is suppose to be an explosion once it hits the ground… iv been following FPStutorial.

Here is the error msg:

MissingComponentException: There is no 'Collider' attached to the "Missile(Clone) game object, but a script is trying to access it.
You probably need to add a Collider to the game object "Missile(Close)". Or your script needs to check if the component is attached before using it.

If i double click on it, this is my code, which was working last time but the bullets were going backwards:

var projectile : Rigidbody;
var speed = 20;
function Update()
{
if( Input.GetButtonDown( "Fire1" ) )
{
var instantiatedProjectile : Rigidbody = Instantiate(
projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity =
transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider,
transform.root.collider );
}
}

The error message says it all! Select your “Missile” prefab and add a collider to it.

The second part of your error message says “Or your script needs to check if the component is attached before using it.” Here’s one way to do that:

if (instantiatedProjectile.GetComponent(Collider) != null) {
    Physics.IgnoreCollision( instantiatedProjectile. collider, 
transform.root.collider );
}

I didn’t test that code, but that’s the basic idea.

Thanks guys i sorted that somehow using other code.
but thanks for the help :slight_smile: