Skip to content

Commit 69cd160

Browse files
committed
Fixed an issue where ParticleEmitter had NaN bounds during the first update when added to the scene graph during the update loop
1 parent 789daa6 commit 69cd160

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1101,9 +1101,12 @@ private void updateParticleState(float tpf) {
11011101

11021102
lastPos.set(getWorldTranslation());
11031103

1104-
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
1105-
bbox.setMinMax(min, max);
1106-
this.setBoundRefresh();
1104+
//This check avoids a NaN bounds when all the particles are dead during the first update.
1105+
if (!min.equals(Vector3f.POSITIVE_INFINITY) && !max.equals(Vector3f.NEGATIVE_INFINITY)) {
1106+
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
1107+
bbox.setMinMax(min, max);
1108+
this.setBoundRefresh();
1109+
}
11071110

11081111
vars.release();
11091112
}

0 commit comments

Comments
 (0)