Hi,
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/ParticleMesh.java
===================================================================
--- C:/Desenvolvimento/Java/eclipse/workspace/jme2/src/com/jmex/effects/particles/ParticleMesh.java (revision 4039)
+++ C:/Desenvolvimento/Java/eclipse/workspace/jme2/src/com/jmex/effects/particles/ParticleMesh.java (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 @@
particleGeom.setCastsShadows(false);
}
+ /**
+ * 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++) {