Browse Source

Making sure created radius is always finite
This cased a bug when creating a default arcrotate camera in an empty scene

Raanan Weber 7 years ago
parent
commit
f8fa860f0c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/babylon.scene.ts

+ 3 - 0
src/babylon.scene.ts

@@ -4662,6 +4662,9 @@
 
 
                 var camera: TargetCamera;
                 var camera: TargetCamera;
                 var radius = worldSize.length() * 1.5;
                 var radius = worldSize.length() * 1.5;
+                if (!isFinite(radius)) {
+                    radius = 1;
+                }
                 if (createArcRotateCamera) {
                 if (createArcRotateCamera) {
                     var arcRotateCamera = new ArcRotateCamera("default camera", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this);
                     var arcRotateCamera = new ArcRotateCamera("default camera", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this);
                     arcRotateCamera.lowerRadiusLimit = radius * 0.01;
                     arcRotateCamera.lowerRadiusLimit = radius * 0.01;