- Home /
Instantiate a particle emitter when object touches ground.
I was wondering how I should approach making it when my "bullet" hits the ground that it instantiates a one shot particle emitter. Here is my code so far, but I dont want it to be on a trigger.
var explodePrefab : Transform;
function OnTriggerEnter(other : Collider) { if(other.gameObject.name == "ground") { var explode = Instantiate(explodePrefab ,transform.position ,Quaternion.identity); Destroy (explode, 0.5); } }
Comment
Answer by uhahaha · Jan 01, 2011 at 01:42 AM
Another option is to use OnCollisionEnter:
http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html