Selaa lähdekoodia

Update babylon.scene.ts

When disposing a camera, its reference was still in activeCamera and activeCameras
Temechon 10 vuotta sitten
vanhempi
commit
75c72c8c59
1 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  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));
         }
     }
-} 
+}