Delete individual particles?

Hi folks!

So I’m making a drawline func that draws individual particles with a particleemitter and the
function Emit (pos : Vector3, velocity : Vector3, size : float, energy : float, color : Color) : void

Works great. Now I want to be able to undraw a segment- anyone know how to delete a particle? I currently do the following:
Particle[ ] myParticles = particleEmitter.particles;
myParticles[3].energy = 0; //assume 3 is ok for sake of example
particleEmitter.particles = myParticles;

But for some reason, this only works on about half the particles, and the terminal particle actually gets brighter. I currently have my particleEmitter.emit set to off, does it need to be on for the particles to update (i.e. die due to lack of energy)? Anyone know a better way to kill a particle?

Thanks so much for your time!

Having encountered a somewhat similar situation once, I seem to vaguely remember that you have to set the energy to a little above zero, so it expires “naturally”.

–Eric

The docs say that you can kill a particle by setting its energy to zero or less, but when I tried that, very strange things happened. In particular, it seemed to cause particles to respawn in clumps at the same location. After spending some time killing some but not all of the particles, the emitter ends up generating every new particle with exactly the same position, velocity and other settings instead of randomly distributing them according to the emitter’s parameters. This is presumably a bug, and I’ll file a report on it when I get a moment. You might want to do the same.

As Eric says, it seems to work reliably if you set the energy to slightly more than zero instead (something like 0.0001 is fine).

Thanks guys!

Had to deal with some other forums recently, and MAN it’s good to be home. You guys rock

Oh yeah, I was witnessing the same particle clump behavior myself. I’ll try to send a report this evening.

Alas, setting the energy to 0.0001 didn’t work. I tried it with the particleEmitter.emit on and off. The emitter’s settings don’t conflict with the emit() function do they? i.e. If I emit a particle with 0.0001 energy, but my emitter’s minEnergy is set to 10, are my emit call parameters adjusted? I’ve tried with all different settings in my emitter, but it doesn’t seem to affect my call at all (which is desired, I think).

My mistake, it doesn’t seem to like very small numbers. 0.01 works for me.

I finally got around to filing a pretty comprehensive bug report (case 165514), so hopefully it’ll be fixed in due course.

What a funky bug… good catch (and thanks for the repro case, we’re looking at it right now)

:slight_smile:

d.