Explosion Elimination script

I want my space craft to explode when it collides. Thankyou if you answer and thankyou person who answered my previose questions.

2 Answers

2
var explosionEffect : Transform; // Explosion effect goes here    

function OnCollisionEnter (hit : Collision)
    {
    if(hit.gameObject)
    {
    Destroy(gameObject);
    Instantiate(explosionEffect, transform.position, transform.rotation);
    }
    }

This dose not work if you are using a characterController.

yes but he asked for it to explode when it collides. this answer script simply deletes the collider.

Simply Instantiate a particle system problem solved.

Searching UnityAnswers for "explosion" gave me a bunch of useful results, particularly one on 'Scripting Impact Explosion'.

Please search before posting new/duplicate questions.