File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
jme3-core/src/main/java/com/jme3/effect Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ public class ParticleEmitter extends Geometry {
106
106
private boolean worldSpace = true ;
107
107
//variable that helps with computations
108
108
private transient Vector3f temp = new Vector3f ();
109
+ private transient Vector3f lastPos ;
109
110
110
111
public static class ParticleEmitterControl implements Control {
111
112
@@ -1013,12 +1014,16 @@ private void updateParticleState(float tpf) {
1013
1014
1014
1015
// Spawns particles within the tpf timeslot with proper age
1015
1016
float interval = 1f / particlesPerSec ;
1017
+ float originalTpf = tpf ;
1016
1018
tpf += timeDifference ;
1017
1019
while (tpf > interval ){
1018
1020
tpf -= interval ;
1019
1021
Particle p = emitParticle (min , max );
1020
1022
if (p != null ){
1021
1023
p .life -= tpf ;
1024
+ if (lastPos != null ) {
1025
+ p .position .interpolateLocal (lastPos , 1 - tpf / originalTpf );
1026
+ }
1022
1027
if (p .life <= 0 ){
1023
1028
freeParticle (lastUsed );
1024
1029
}else {
@@ -1028,6 +1033,12 @@ private void updateParticleState(float tpf) {
1028
1033
}
1029
1034
timeDifference = tpf ;
1030
1035
1036
+ if (lastPos == null ) {
1037
+ lastPos = new Vector3f ();
1038
+ }
1039
+
1040
+ lastPos .set (getWorldTranslation ());
1041
+
1031
1042
BoundingBox bbox = (BoundingBox ) this .getMesh ().getBound ();
1032
1043
bbox .setMinMax (min , max );
1033
1044
this .setBoundRefresh ();
You can’t perform that action at this time.
0 commit comments