Particle Problem:

I got a problem with particles -> Nothing is showing, please help me troubleshoot this, I am a few days new to jME.


   protected void simpleInitGame() {
      TextureState ts=display.getRenderer().createTextureState();
      URL monkeyLoc;
      monkeyLoc=Particles.class.
      getClassLoader().getResource(
      "Spherical.png");
      
      Texture t =
         TextureManager.loadTexture(monkeyLoc,
         Texture.MM_LINEAR,
         Texture.FM_LINEAR,1,true);
      ts.setTexture(t);
      AlphaState as = display.getRenderer().createAlphaState();
      as.setBlendEnabled(false);
      as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
      as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
      as.setTestEnabled(true);
      as.setTestFunction(AlphaState.TF_GREATER);
      
      ParticleManager manager = new ParticleManager(300, display.getRenderer().getCamera());
      manager.setGravityForce(new Vector3f(0.0f, 0.0f, 0.0f));
      manager.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f));
      manager.setEmissionMaximumAngle(0.20943952f);
      manager.setSpeed(1.0f);
      manager.setParticlesMinimumLifeTime(1000.0f);
      manager.setStartSize(40.0f);
      manager.setEndSize(40.0f);
      manager.setStartColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 1.0f));
      manager.setEndColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 0.0f));
      manager.setRandomMod(6.0f);
      manager.setControlFlow(true);
      manager.setReleaseRate(300);
      manager.setReleaseVariance(0.0f);
      manager.setInitialVelocity(0.29999998f);
      manager.setParticleSpinSpeed(0.0f);

      manager.warmUp(1000);
      manager.getParticles().addController(manager);

      Node myNode = new Node("Particle Nodes");
      myNode.setRenderState(ts);
      myNode.setRenderState(as);
      myNode.attachChild(manager.getParticles());
      ZBufferState zstate = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
      zstate.setEnabled(false);
      manager.getParticles().setRenderState(zstate);

   }
   
}

you just need to add this to the end of your method:


rootNode.attachChild(myNode);



because right now your node and particle system are floating around in nowhere land.

It works now, but I need to work on it :). Thanks a bunch Mr. Dev

Hey, how do I set where the particles are emitted from, or is there a way to set the camara to look at them? Since every time the camera is right smack-dab in the middle of the particles.

try calling setLocalTranslation on your node, something like:


myNode.setLocalTranslation(new Vector3f(0, 0, -30));