Is it possible to convert a particle to an emitter or attach particles to another particle?

I have an emitter that throws a few physics particles (big debris like it’s mentioned in the docs). I want to attach some trailing particles to each of those falling debris.

Is that possible? I think I would need to turn them to emitters to achieve that.

I’m not really worried about performance since I won’t have more than 5 physics particles on screen at once. Maybe it’s better if I just create them as emitters instead of particles, but I wanted Particle Candy to handle the clean up (Debris is destroyed once it hits the ground and new ones appear). [import]uid: 10835 topic_id: 5857 reply_id: 305857[/import]

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]