Hello, I currently have a rocket (instantiated) that instantiates an explosion when its collider is triggered. This rocket has a smoke trail (smoke particles with 0 local or world velocity).
I want the smoke to "hang" in the air even after the explosion is finished (so destroying the entire game object is not an option). Unfortunately, when the rocket explodes, the smoke leaves a "smoke cluster" which is basically the smoke collecting together to the point of impact.
I need a smoke trail that slowly dissipates, doesn't leave a "smoke cluster", and doesn't just disappear right away unnaturally (via destroying or hiding).
Thanks in advance, CarbonTech Software Admin
Answer by spinaljack
Jun 29, 2010 at 12:24 AM
You can try clicking simulate in world space to stop the particles moving with the missile.
Set the min and max energy for how long you want the particles to hang around for.
After the missile explodes you can unparent the emitter from the missile before destroying the missile so that the smoke hangs around. (Stop the emitting at this time as well)
Setting a script to destroy the emitter a set time after being detached will prevent lots of smoke emitters cluttering up the game.
Where maxLife is the maximum amount of time a particle will hang around for so you can be sure every particle has gone before removing the emitter object.
so what ways are there to get particles to fade in/out, the particle animator isnt working for me
Answer by herp johnson
Aug 28, 2012 at 04:02 AM
That's a complicated way to do it, jack. Why not use the tools with which Unity has already provided us? Most of this can be accomplished through Inspector. There is no need for complicated script to destroy the emitter--the only scripting required is to set particleEmitter.emit to false.
Use a particle emitter, a particle renderer, and a particle animator. Select your material in the particle renderer. In the particle animator's color animation section, you can change the Alpha value (A) to change the opacity of the material. In this case, you would make the alpha (A) a value of 0 in the last color block to fade out the trail.
As for stopping your "cluster," you can set yourGameObject.particleEmitter.emit to false on collision with the target object. So basically, you'd end up with something like this:
function OnCollisionEnter(collision : Collision)
yourGameObject.particleEmitter.emit = false;
Sorry I posted this so late, but I hope it helps you streamline the process next time you're using particle emitters! :)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
1 Person is following this question.
Spawned Particle System in game looks different from prefab
Rocket Explosion not applying damage when hitting ground
How to produce the item collection particle effect?
Trail Renderer which ignores parent movement