Rotating the particles?

Particles are basically quads that you texture and set colors etc. So I should be able to rotate those quads, so that they look like tiny "floors" that float up.

So what I'm saying is I want to rotate each particle so that it is oriented like the ground that the player is standing on, and have those float directly up, like stacks of paper.

I have already used setCameraFacing(false); to prevent it from rotating the quads at the camera, now all I need to do is have them float upwards. Any help is appreciated.


i guess i solved your problem some time ago.

I had the problem that i liked to have the particles stay in position and facing upwards.

I found that the localRotation and the localTranslation get reset in the updadeWold() of ParticleGeometry.

At least in the jme1 version.

I suggest to check if this is still the case in jme2.

I verified that it's possible to emit the particles upwards and facing upwards.

So here is the slightly altered test (you can compare it with the one in my Thread):

import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;
import com.jmex.effects.particles.ParticleFactory;
import com.jmex.effects.particles.ParticleMesh;

public class TestParticles extends SimpleGame {

   protected void simpleInitGame() {
      //Set up floor and indicators for the axis.
      Box floor = new Box("",Vector3f.ZERO,30,0.2f,30);
      floor.setLocalTranslation(0, -0.4f, 0);
      Box xBox = new Box("",new Vector3f(5,0,0),1,1,1);
      Sphere zSphere = new Sphere("", new Vector3f(0,0,5),4,4,1);
      //init the particles
      ParticleMesh particles = ParticleFactory.buildParticles("Fountain", 4, ParticleMesh.PT_QUAD);
      particles.setEndColor(new ColorRGBA(255,0,0,0));
      //dont want the particles direction to be influenced by velocity or camera
      //**Interesting Part**
      //****Approach I:****
      //try to rotate the particles to be emmited in +y direction and facing +y by
//      particles.setEmissionDirection(new Vector3f(0,0,0));
      particles.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.PI/2, Vector3f.UNIT_X));
//      particles.setRotateWithScene(true);
//      particles.setWorldEmit(new Vector3f(0,0,1));
//      particles.setParticleOrientation(FastMath.PI/2);
//      particles.rotateUpTo(Vector3f.UNIT_Y);
//      particles.lookAt(new Vector3f(0,500,0), Vector3f.UNIT_Y);
//      ParticleController controller = (ParticleController) particles.getControllers().get(0);
//      controller.getParticles().setLocalRotation(new Quaternion().fromAngleAxis(FastMath.PI/2, Vector3f.UNIT_X));
//      controller.getParticles().lookAt(new Vector3f(0,500,0), Vector3f.UNIT_Y);
      //****Approach II:****
      //try to put the particles into a new node and rotate the particles using the nodes translation
//      particles.setLocalRotation(new Quaternion().fromAngleAxis(0, Vector3f.UNIT_X));
//      Node particleNode = new Node();
//      particleNode.attachChild(particles);
//      particleNode.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.PI/2, Vector3f.UNIT_X));
//      rootNode.attachChild(particleNode);
      rootNode.updateGeometricState(0, true);
   public static void main(String[] args) {
      TestParticles app = new TestParticles();


hope this helps.