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