diff --git a/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java b/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java index 28bfd595d..ca3467781 100644 --- a/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java +++ b/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java @@ -106,6 +106,7 @@ public class ParticleEmitter extends Geometry { private boolean worldSpace = true; //variable that helps with computations private transient Vector3f temp = new Vector3f(); + private transient Vector3f lastPos; public static class ParticleEmitterControl implements Control { @@ -1013,12 +1014,16 @@ public class ParticleEmitter extends Geometry { // Spawns particles within the tpf timeslot with proper age float interval = 1f / particlesPerSec; + float originalTpf = tpf; tpf += timeDifference; while (tpf > interval){ tpf -= interval; Particle p = emitParticle(min, max); if (p != null){ p.life -= tpf; + if (lastPos != null && isInWorldSpace()) { + p.position.interpolateLocal(lastPos, 1 - tpf / originalTpf); + } if (p.life <= 0){ freeParticle(lastUsed); }else{ @@ -1028,6 +1033,12 @@ public class ParticleEmitter extends Geometry { } timeDifference = tpf; + if (lastPos == null) { + lastPos = new Vector3f(); + } + + lastPos.set(getWorldTranslation()); + BoundingBox bbox = (BoundingBox) this.getMesh().getBound(); bbox.setMinMax(min, max); this.setBoundRefresh();