فهرست منبع

Merge pull request #464 from Temechon/patch-31

Update babylon.scene.ts
David Catuhe 10 سال پیش
والد
کامیت
9224dcfd57
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  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));
         }
     }
-} 
+}