Skip to content

Commit

Permalink
Fixed an issue where ParticleEmitter had NaN bounds during the first …
Browse files Browse the repository at this point in the history
…update when added to the scene graph during the update loop
  • Loading branch information
Nehon committed Jan 26, 2017
1 parent 789daa6 commit 69cd160
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1101,9 +1101,12 @@ private void updateParticleState(float tpf) {

lastPos.set(getWorldTranslation());

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

vars.release();
}
Expand Down

0 comments on commit 69cd160

Please sign in to comment.