- Home /
ParticleEmitter
public var ParticleEmitter : GameObject;
function OnCollisionEnter( collision : Collision )
{
if (collision.gameObject) {
ParticleEmitter.particleEmitter.emit = true;
}
}
how to make that particles emit only when collision is detected?
Answer by DaveA · Sep 12, 2012 at 10:12 PM
You should call your P.E. particleEmitter (start lower case) so as not to confuse it with a class of that name.
What you have should work, and you can actually remove the 'if' test. You would want to initialize the emitter to emit = false. If you want to turn it off when the thing is no longer colliding, implement OnCollisionExit() and set emit to false. If you want to emit when a particular object is colliding, check collision's name or tag to see if it's the one you want, and act accordingly.
Your answer
Follow this Question
Related Questions
Car wheel script delay. 1 Answer
Vehicle engine RPM without wheelcolliders? 1 Answer
Square wheels 4 Answers
When car somersault 0 Answers