Procházet zdrojové kódy

Merge pull request #464 from Temechon/patch-31

Update babylon.scene.ts
David Catuhe před 10 roky
rodič
revize
9224dcfd57
1 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. 11 1
      Babylon/babylon.scene.ts

+ 11 - 1
Babylon/babylon.scene.ts

@@ -760,6 +760,16 @@
                 // Remove from the scene if mesh found 
                 this.cameras.splice(index, 1);
             }
+            // Remove from activeCameras
+            var index2 = this.activeCameras.indexOf(toRemove);
+            if (index2 !== -1) {
+                // Remove from the scene if mesh found
+                this.activeCameras.splice(index2, 1);
+            }
+            // Reset the activeCamera
+            if (this.activeCamera === toRemove) {
+                this.activeCamera = null;
+            }
             if (this.onCameraRemoved) {
                 this.onCameraRemoved(toRemove);
             }
@@ -2160,4 +2170,4 @@
             return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));
         }
     }
-} 
+}