From 69cd160956c67709e8a67f483d63949fe88628bb Mon Sep 17 00:00:00 2001 From: Nehon Date: Thu, 26 Jan 2017 21:09:02 +0100 Subject: [PATCH] Fixed an issue where ParticleEmitter had NaN bounds during the first update when added to the scene graph during the update loop --- .../src/main/java/com/jme3/effect/ParticleEmitter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 1af2bf1d15..d5c0b9d752 100644 --- a/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java +++ b/jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java @@ -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(); }