- Home /
Answer by FLASHDENMARK · Apr 21, 2011 at 06:53 AM
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.
Answer by · Apr 21, 2011 at 07:36 AM
Searching UnityAnswers for "explosion" gave me a bunch of useful results, particularly one on 'Scripting Impact Explosion'.
Please search before posting new/duplicate questions.
Your answer
Follow this Question
Related Questions
Meteor Explosion, Destroy on Impact 2 Answers
Tank Missle Colide then explode and destroy 1 Answer
Bullets wont collide and destroy object 1 Answer
Destructible tank? 1 Answer