Particle trails can quickly produce a very high amount of particles, so they should be handled with caution.
Particle Candy currently does not provide a feature to create particle trails directly (because this can really kill performance quickly), but since you are using a small number of debris only, you could create a few physics objects (debris) and group emitters to it.
The only downside, as you said, is that you will have to clean the debris objects up on your own. But it would be a good idea to create some debris objects that stay hidden and are re-used every time an explosion happens.
This could be done like this:
Create some debris objects on level start (physics driven groups, emitter placed inside). Attach some “debris smoke” to the emitter and set the emission time to 3 seconds, for example. Then attach a particle listener to the emitter that is called each time a particle dies. If something explodes, active the debris objects and also start the emitter inside.
The particle listener will be called then each time a “debris smoke” particle dies and check if the emitter is still running. If not (means if 3 seconds have passed), the debris object will be reset and set to inactive again until it is used the next time:
[lua]Particles.SetEmitterListener(“DebrisEmitter”, onParticleDeath)
…
function onParticleDeath( event )
– GET NAME OF PARTICLE TYPE
if event.typeName == “DebrisSmoke” then
local Emitter = Particles.GetEmitter(event.emitterName)
local DebrisObj = Emitter.parent
– EMITTER HAS FINISHED EMISSION?
if Particles.EmitterIsActive(event.emitterName) == false then
DebrisObj.bodyType = “kinematic”
DebrisObj:setLinearVelocity( 0, 0 )
DebrisObj.angularVelocity = 0
DebrisObj.x = -1000
DebrisObj.y = -1000
DebrisObj.isVisible = false
end
end
end[/lua]
[import]uid: 10504 topic_id: 5857 reply_id: 20104[/import]