Particle Effects

Hello,



I'm new to JME, and I'm having some trouble with particle effects. Instead of the firework effect I'm looking for, I only see one stationary particle in the center of the screen that refuses to be affected by translations.  Here is how I create the ParticleMesh I would like to see


private ParticleMesh makeParticle() {
      //build mesh
      ParticleMesh pPoints = ParticleFactory.buildParticles("particles", 10);
      
      //set up particles
      pPoints.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f));
      pPoints.setMaximumAngle(3.1415927f);
      pPoints.setMinimumAngle(0);
      pPoints.getParticleController().setSpeed(.4f);
      pPoints.setMinimumLifeTime(100.0f);
      pPoints.setMaximumLifeTime(250.0f);
      pPoints.setStartSize(1.0f);
      pPoints.setEndSize(50.0f);
      pPoints.setStartColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 1.0f));
      pPoints.setEndColor(new ColorRGBA(1.0f, 0.24313726f,
                0.03137255f, 0.0f));
      
      //try to make this mesh not repeat
      pPoints.setRepeatType(Controller.RT_CLAMP);

      //set the texture of the particles
      pPoints.setRenderState(ts);
      
      ZBufferState zstate = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
      zstate.setEnabled(false);
      pPoints.setRenderState(zstate);

      pPoints.setModelBound(new BoundingBox());
      pPoints.updateModelBound();
      
      return pPoints;
   }



I attach the ParticleMesh to my scene like so

      
                //make a particle mesh
           ParticleMesh pPoints = makeParticle();
           //create a node to attach it to
           Node particleNode = new Node();
           //attach to node
           particleNode.attachChild(pPoints);
           //try to move the node someplace
           particleNode.setLocalTranslation(100,100,10);
           //attach node to this because we're in an object that extends node
           this.attachChild(particleNode);
           //do a force re-spawn
           for (Spatial element : particleNode.getChildren()) {
              ((ParticleGeometry) element).forceRespawn();
         }



I've looked though all of the examples and I can't for the life of me figure out what's wrong.

Maybe this thread can help you: http://www.jmonkeyengine.com/jmeforum/index.php?topic=6494

The bottom line is that you may have to use flow control, and call pPoints.updateGeometricState(0, true); after setting up your particles.

Thanks so much! That fixed it.  :smiley: