sebavan преди 6 години
родител
ревизия
5a96d2de06

Файловите разлики са ограничени, защото са твърде много
+ 8487 - 5637
Playground/babylon.d.txt


Файловите разлики са ограничени, защото са твърде много
+ 4124 - 4124
dist/preview release/babylon.d.ts


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/babylon.js


+ 18 - 10
dist/preview release/babylon.max.js

@@ -102943,6 +102943,9 @@ var BABYLON;
             this.utilityLayerScene.detachControl();
             if (handleEvents) {
                 this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {
+                    if (!_this.utilityLayerScene.activeCamera) {
+                        return;
+                    }
                     if (!_this.processAllEvents) {
                         if (prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERMOVE
                             && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERUP
@@ -103124,7 +103127,12 @@ var BABYLON;
             this.utilityLayerScene.dispose();
         };
         UtilityLayerRenderer.prototype._updateCamera = function () {
-            this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            if (this.originalScene.activeCameras.length > 1) {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCameras[0];
+            }
+            else {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            }
         };
         UtilityLayerRenderer._DefaultUtilityLayer = null;
         UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;
@@ -105468,7 +105476,7 @@ var BABYLON;
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
                             rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
                         }
-                        if (this.fixedDragMeshScreenSize) {
+                        if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                             rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                             var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                             rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
@@ -105489,7 +105497,7 @@ var BABYLON;
                         if (scaleBoxes[index]) {
                             scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             scaleBoxes[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            if (this.fixedDragMeshScreenSize) {
+                            if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                                 scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                                 var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                                 scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
@@ -105555,13 +105563,6 @@ var BABYLON;
             var box = BABYLON.MeshBuilder.CreateBox("box", { size: 1 }, mesh.getScene());
             var boundingMinMax = mesh.getHierarchyBoundingVectors();
             boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);
-            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
-            // Restore original positions
-            mesh.addChild(box);
-            mesh.rotationQuaternion.copyFrom(oldRot);
-            mesh.position.copyFrom(oldPos);
-            // Reverse parenting
-            mesh.removeChild(box);
             // Adjust scale to avoid undefined behavior when adding child
             if (box.scaling.y === 0) {
                 box.scaling.y = BABYLON.Epsilon;
@@ -105572,6 +105573,13 @@ var BABYLON;
             if (box.scaling.z === 0) {
                 box.scaling.z = BABYLON.Epsilon;
             }
+            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
+            // Restore original positions
+            mesh.addChild(box);
+            mesh.rotationQuaternion.copyFrom(oldRot);
+            mesh.position.copyFrom(oldPos);
+            // Reverse parenting
+            mesh.removeChild(box);
             box.addChild(mesh);
             box.visibility = 0;
             return box;

+ 18 - 10
dist/preview release/babylon.no-module.max.js

@@ -102910,6 +102910,9 @@ var BABYLON;
             this.utilityLayerScene.detachControl();
             if (handleEvents) {
                 this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {
+                    if (!_this.utilityLayerScene.activeCamera) {
+                        return;
+                    }
                     if (!_this.processAllEvents) {
                         if (prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERMOVE
                             && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERUP
@@ -103091,7 +103094,12 @@ var BABYLON;
             this.utilityLayerScene.dispose();
         };
         UtilityLayerRenderer.prototype._updateCamera = function () {
-            this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            if (this.originalScene.activeCameras.length > 1) {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCameras[0];
+            }
+            else {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            }
         };
         UtilityLayerRenderer._DefaultUtilityLayer = null;
         UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;
@@ -105435,7 +105443,7 @@ var BABYLON;
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
                             rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
                         }
-                        if (this.fixedDragMeshScreenSize) {
+                        if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                             rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                             var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                             rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
@@ -105456,7 +105464,7 @@ var BABYLON;
                         if (scaleBoxes[index]) {
                             scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             scaleBoxes[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            if (this.fixedDragMeshScreenSize) {
+                            if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                                 scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                                 var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                                 scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
@@ -105522,13 +105530,6 @@ var BABYLON;
             var box = BABYLON.MeshBuilder.CreateBox("box", { size: 1 }, mesh.getScene());
             var boundingMinMax = mesh.getHierarchyBoundingVectors();
             boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);
-            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
-            // Restore original positions
-            mesh.addChild(box);
-            mesh.rotationQuaternion.copyFrom(oldRot);
-            mesh.position.copyFrom(oldPos);
-            // Reverse parenting
-            mesh.removeChild(box);
             // Adjust scale to avoid undefined behavior when adding child
             if (box.scaling.y === 0) {
                 box.scaling.y = BABYLON.Epsilon;
@@ -105539,6 +105540,13 @@ var BABYLON;
             if (box.scaling.z === 0) {
                 box.scaling.z = BABYLON.Epsilon;
             }
+            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
+            // Restore original positions
+            mesh.addChild(box);
+            mesh.rotationQuaternion.copyFrom(oldRot);
+            mesh.position.copyFrom(oldPos);
+            // Reverse parenting
+            mesh.removeChild(box);
             box.addChild(mesh);
             box.visibility = 0;
             return box;

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/babylon.worker.js


+ 18 - 10
dist/preview release/es6.js

@@ -102910,6 +102910,9 @@ var BABYLON;
             this.utilityLayerScene.detachControl();
             if (handleEvents) {
                 this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {
+                    if (!_this.utilityLayerScene.activeCamera) {
+                        return;
+                    }
                     if (!_this.processAllEvents) {
                         if (prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERMOVE
                             && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERUP
@@ -103091,7 +103094,12 @@ var BABYLON;
             this.utilityLayerScene.dispose();
         };
         UtilityLayerRenderer.prototype._updateCamera = function () {
-            this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            if (this.originalScene.activeCameras.length > 1) {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCameras[0];
+            }
+            else {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            }
         };
         UtilityLayerRenderer._DefaultUtilityLayer = null;
         UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;
@@ -105435,7 +105443,7 @@ var BABYLON;
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
                             rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
                         }
-                        if (this.fixedDragMeshScreenSize) {
+                        if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                             rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                             var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                             rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
@@ -105456,7 +105464,7 @@ var BABYLON;
                         if (scaleBoxes[index]) {
                             scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             scaleBoxes[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            if (this.fixedDragMeshScreenSize) {
+                            if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                                 scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                                 var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                                 scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
@@ -105522,13 +105530,6 @@ var BABYLON;
             var box = BABYLON.MeshBuilder.CreateBox("box", { size: 1 }, mesh.getScene());
             var boundingMinMax = mesh.getHierarchyBoundingVectors();
             boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);
-            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
-            // Restore original positions
-            mesh.addChild(box);
-            mesh.rotationQuaternion.copyFrom(oldRot);
-            mesh.position.copyFrom(oldPos);
-            // Reverse parenting
-            mesh.removeChild(box);
             // Adjust scale to avoid undefined behavior when adding child
             if (box.scaling.y === 0) {
                 box.scaling.y = BABYLON.Epsilon;
@@ -105539,6 +105540,13 @@ var BABYLON;
             if (box.scaling.z === 0) {
                 box.scaling.z = BABYLON.Epsilon;
             }
+            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
+            // Restore original positions
+            mesh.addChild(box);
+            mesh.rotationQuaternion.copyFrom(oldRot);
+            mesh.position.copyFrom(oldPos);
+            // Reverse parenting
+            mesh.removeChild(box);
             box.addChild(mesh);
             box.visibility = 0;
             return box;

+ 2 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -2026,6 +2026,8 @@ declare module BABYLON.GUI {
             barBackground: string;
             /** @hidden */
             protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+            /** Releases associated resources */
+            dispose(): void;
     }
 }
 declare module BABYLON.GUI {

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/gui/babylon.gui.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js.map


+ 4 - 0
dist/preview release/gui/babylon.gui.module.d.ts

@@ -2178,6 +2178,8 @@ declare module 'babylonjs-gui/2D/controls/scrollViewer' {
             barBackground: string;
             /** @hidden */
             protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+            /** Releases associated resources */
+            dispose(): void;
     }
 }
 
@@ -5158,6 +5160,8 @@ declare module BABYLON.GUI {
             barBackground: string;
             /** @hidden */
             protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+            /** Releases associated resources */
+            dispose(): void;
     }
 }
 declare module BABYLON.GUI {

Файловите разлики са ограничени, защото са твърде много
+ 5 - 5
dist/preview release/inspector/babylon.inspector.bundle.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js.map


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 0
dist/preview release/what's new.md

@@ -107,6 +107,7 @@
 - TransformNode lookAt not working in world space when node's parent has rotation ([TrevorDev](https://github.com/TrevorDev))
 - MakeNotPickableAndWrapInBoundingBox had unexpected behavior when input had scaling of 0 on an axis ([TrevorDev](https://github.com/TrevorDev))
 - Fixed an issue with loading base64 encoded images in the glTF loader ([bghgary](https://github.com/bghgary))
+- In multi-camera scenes the inspector would cause the camera's interaction events to get detached ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))

+ 2 - 2
inspector/src/components/sceneExplorer/entities/cameraTreeItemComponent.tsx

@@ -38,10 +38,10 @@ export class CameraTreeItemComponent extends React.Component<ICameraTreeItemComp
         const camera = this.props.camera;
         const scene = camera.getScene();
         this._onActiveCameraObserver = scene.onActiveCameraChanged.add(() => {
-            if (this.state.isActive) {
+            // This will deactivate the previous camera when the camera is changed. Multiple camera's cycle frequently so only do this for single cameras
+            if (this.state.isActive && scene.activeCameras.length <= 1) {
                 camera.detachControl(scene.getEngine().getRenderingCanvas()!);
             }
-
             this.setState({ isActive: scene.activeCamera === camera });
         });
     }

+ 16 - 1
inspector/src/tools.ts

@@ -16,12 +16,27 @@ export class Tools {
         return false;
     }
 
+    private static _RecursiveRemoveHiddenMeshesAndHoistChildren(items: Array<any>) {
+        let result: Array<any> = [];
+        for (let i of items) {
+            // If the mesh is hidden, add it's children that are not hidden, this will handle the case of bounding box parenting for bounding box gizmo
+            if (i.reservedDataStore && i.reservedDataStore.hidden) {
+                Tools._RecursiveRemoveHiddenMeshesAndHoistChildren(i.getChildMeshes()).forEach((m) => {
+                    result.push(m);
+                });
+            }else {
+                result.push(i);
+            }
+        }
+        return result;
+    }
+
     public static SortAndFilter(parent: any, items: any[]): any[] {
         if (!items) {
             return [];
         }
 
-        const finalArray = items.filter((i) => !i.reservedDataStore || !i.reservedDataStore.hidden);
+        const finalArray = Tools._RecursiveRemoveHiddenMeshesAndHoistChildren(items);
 
         if (parent && parent.reservedDataStore && parent.reservedDataStore.detachedChildren) {
             finalArray.push(...parent.reservedDataStore.detachedChildren);

+ 14 - 13
src/Gizmos/boundingBoxGizmo.ts

@@ -422,8 +422,8 @@ import { StandardMaterial } from "Materials/standardMaterial";
                             rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
                             rotateSpheres[index].lookAt(Vector3.Cross(Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
                         }
-                        if (this.fixedDragMeshScreenSize) {
-                            rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera!.position, this._tmpVector);
+                        if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
+                            rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                             var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                             rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
                         } else {
@@ -443,8 +443,8 @@ import { StandardMaterial } from "Materials/standardMaterial";
                         if (scaleBoxes[index]) {
                             scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             scaleBoxes[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            if (this.fixedDragMeshScreenSize) {
-                                scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera!.position, this._tmpVector);
+                            if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
+                                scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
                                 var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
                                 scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
                             } else {
@@ -511,15 +511,6 @@ import { StandardMaterial } from "Materials/standardMaterial";
             var box = MeshBuilder.CreateBox("box", { size: 1 }, mesh.getScene());
             var boundingMinMax = mesh.getHierarchyBoundingVectors();
             boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);
-            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
-
-            // Restore original positions
-            mesh.addChild(box);
-            mesh.rotationQuaternion.copyFrom(oldRot);
-            mesh.position.copyFrom(oldPos);
-
-            // Reverse parenting
-            mesh.removeChild(box);
 
             // Adjust scale to avoid undefined behavior when adding child
             if (box.scaling.y === 0) {
@@ -532,6 +523,16 @@ import { StandardMaterial } from "Materials/standardMaterial";
                 box.scaling.z = Epsilon;
             }
 
+            box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
+
+            // Restore original positions
+            mesh.addChild(box);
+            mesh.rotationQuaternion.copyFrom(oldRot);
+            mesh.position.copyFrom(oldPos);
+
+            // Reverse parenting
+            mesh.removeChild(box);
+
             box.addChild(mesh);
             box.visibility = 0;
             return box;

+ 8 - 2
src/Rendering/utilityLayerRenderer.ts

@@ -95,7 +95,9 @@ import { AbstractMesh } from "Meshes/abstractMesh";
 
             if (handleEvents) {
                 this._originalPointerObserver = originalScene.onPrePointerObservable.add((prePointerInfo, eventState) => {
-
+                    if (!this.utilityLayerScene.activeCamera) {
+                        return;
+                    }
                     if (!this.processAllEvents) {
                         if (prePointerInfo.type !== PointerEventTypes.POINTERMOVE
                             && prePointerInfo.type !== PointerEventTypes.POINTERUP
@@ -261,6 +263,10 @@ import { AbstractMesh } from "Meshes/abstractMesh";
         }
 
         private _updateCamera() {
-            this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            if (this.originalScene.activeCameras.length > 1) {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCameras[0];
+            }else {
+                this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
+            }
         }
     }