Преглед на файлове

Check during workerCollision set

Setting workerCollisions to true will also check if Worker support
exists in the browser and will set legacy (and false) if not.
Raanan Weber преди 11 години
родител
ревизия
3e411f7984
променени са 2 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 1 1
      Babylon/babylon.scene.js
  2. 3 0
      Babylon/babylon.scene.ts

+ 1 - 1
Babylon/babylon.scene.js

@@ -185,6 +185,7 @@ var BABYLON;
                 return this._workerCollisions;
                 return this._workerCollisions;
             },
             },
             set: function (enabled) {
             set: function (enabled) {
+                enabled = (enabled && !!Worker);
                 this._workerCollisions = enabled;
                 this._workerCollisions = enabled;
                 if (this.collisionCoordinator) {
                 if (this.collisionCoordinator) {
                     this.collisionCoordinator.destroy();
                     this.collisionCoordinator.destroy();
@@ -1731,4 +1732,3 @@ var BABYLON;
     })();
     })();
     BABYLON.Scene = Scene;
     BABYLON.Scene = Scene;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.scene.js.map

+ 3 - 0
Babylon/babylon.scene.ts

@@ -302,6 +302,9 @@
         }
         }
 
 
         public set workerCollisions(enabled: boolean) {
         public set workerCollisions(enabled: boolean) {
+        
+            enabled = (enabled && !!Worker)
+        
             this._workerCollisions = enabled;
             this._workerCollisions = enabled;
             if (this.collisionCoordinator) {
             if (this.collisionCoordinator) {
                 this.collisionCoordinator.destroy();
                 this.collisionCoordinator.destroy();