Stop emitting particles


I was making a burnout smoke and wanted to stop emitting the smoke when the wheel slows, but i didn't find a way to stop the particle emissor.

Controller neither ParticleController has mothods to do that.

So i made a method that put all available (status==Available) particles to dead status (status==Dead).

Here is the patch. It worked well.

Index: C:/Desenvolvimento/Java/eclipse/workspace/jme2/src/com/jmex/effects/particles/
--- C:/Desenvolvimento/Java/eclipse/workspace/jme2/src/com/jmex/effects/particles/   (revision 4039)
+++ C:/Desenvolvimento/Java/eclipse/workspace/jme2/src/com/jmex/effects/particles/   (working copy)
@@ -44,6 +44,7 @@
 import com.jme.util.export.JMEImporter;
 import com.jme.util.export.OutputCapsule;
 import com.jme.util.geom.BufferUtils;
+import com.jmex.effects.particles.Particle.Status;
  * ParticleMesh is a particle system that uses TriMesh as its underlying
@@ -190,6 +191,19 @@
+    /**
+     * Stop emiting particles
+     * Kill all available particles. (status=dead)
+     * @author clovis teixeira
+     */
+    public void stopEmitting()
+    {
+       for (int k = 0; k < numParticles; k++) {
+            if(particles[k].getStatus()==Status.Available)
+               particles[k].setStatus(Status.Dead);
+        }
+    }
     public void draw(Renderer r) {
         Camera camera = r.getCamera();
         for (int i = 0; i < particles.length; i++) {

1 Like

does setting the controller to CLAMP not stop the emitter?

1 Like
Core-Dump said:

does setting the controller to CLAMP not stop the emitter?

No, because i need the animation(emission) to be interrupted. With the clamp the animation run till the end.
1 Like

Is this still the proper solution? Do you still want this clovis?

1 Like

Its working for me.

Im maintaining this method for my project.

I think its is useful because i cant see another way to do that.

1 Like

Commited, r4072.

1 Like