소스 검색

Fixed an issue where ParticleEmitter had NaN bounds during the first update when added to the scene graph during the update loop

Nehon 8 년 전
부모
커밋
69cd160956
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java

+ 6 - 3
jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java

@@ -1101,9 +1101,12 @@ public class ParticleEmitter extends Geometry {
 
         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();
     }