It seems a recent nightly build deprecated several methods regarding particle emitters created two noticeable problems.
- Setting an initial velocity when gravity is set to 0 doesn’t seem to affect particles at all. They simply stand at their spawning point.
emitter.setGravity(0, 0, 0);
emitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, -6));
- Gravity seems to affect particles before their appearance By this I mean that the initial velocity of particles gets faster faster in the direction of gravity. (previously, they would all spawn at the given initial velocity AND THEN get affected by gravity)
On a side note, the addition of being able to set the direction of gravity is very nice
Also, is it possible to created a clipping plane for particles so they don’t get rendered under the world?
Here’s a stand-alone application which demonstrates the first problem, the emitter’s and particle’s size, shape and velocity are the same as in my game.
For some reason, I cannot replicate the second one in a stand-alone application. Hence I wonder what kind of variable change could cause this problem. (I previously was using a gravity of 0 and initial velocity in the desired direction, so the bug could always have been present in my case)
public class EmitterTest extends SimpleApplication
public static void main(final String args)
final EmitterTest app = new EmitterTest();
public void simpleInitApp()
final ParticleEmitter debris = new ParticleEmitter(“Debris”, ParticleMesh.Type.Triangle, 20000);
final Material debris_mat = new Material(assetManager, “Common/MatDefs/Misc/Particle.j3md”);
debris.setShape(new EmitterBoxShape(new Vector3f(-5, -5, 0f), new Vector3f(5, 5, 0f)));
debris.setImagesY(3); // 3x3 texture animation
debris.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, -6));
debris.setStartColor(new ColorRGBA(1f, 1f, 1f, 1f));
debris.setGravity(0f, 0f, 0.0f);