- Home /
particle system that kicks up dust behind a tire
I am creating a vehicle that is driving on a dusty surface and I would like it to kick up a little dust when it is moving but it stops when vehicle is stationary. I have the emmiter all done. I just need to script it on and off when a direction arrow is pressed.
Answer by Mickydtron · Dec 20, 2010 at 11:28 PM
There is a ParticleEmitter.enabled variable that does exactly what you want. just put in your update script something along the lines of
var pe = GameObject.GetComponent("ParticleEmitter");
if(velocity > 1){
pe.enabled = true;
}else{
pe.enabled = false;
}
I probably got some of the syntax wrong, but hopefully you get the idea. See the script reference for the particle emitter: http://unity3d.com/support/documentation/ScriptReference/ParticleEmitter.html
Answer by Ryan 3 · Dec 20, 2010 at 11:33 PM
Thats awesome. Thank you very much.
Please use comments to respond to answers, and not new answers. And marking it correct would be greatly appreciated :)
Answer by ProZac · Dec 21, 2010 at 01:16 AM
You might also want to use minEmission and maxEmission to scale the number of particles with the velocity of you vehicle.
Your answer
Follow this Question
Related Questions
show texture on key down 0 Answers
GUI Label & KeyCode Doesn't Work 1 Answer
troubles with changing scenes 3 Answers
GUI Box Doesn't stay open 1 Answer
c# play animation on key down 1 Answer