Sfoglia il codice sorgente

only detatch control for non-vr cameras

Trevor Baron 7 anni fa
parent
commit
edb47d3205

+ 2 - 2
src/Behaviors/Mesh/babylon.pointerDragBehavior.ts

@@ -163,7 +163,7 @@ module BABYLON {
                             targetPosition.copyFrom((<Mesh>this._attachedNode).absolutePosition)
 
                             // Detatch camera controls
-                            if(this.detachCameraControls && this._scene.activeCamera){
+                            if(this.detachCameraControls && this._scene.activeCamera && !this._scene.activeCamera.leftCamera){
                                 if(this._scene.activeCamera.inputs.attachedElement){
                                     attachedElement = this._scene.activeCamera.inputs.attachedElement;
                                     this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement);
@@ -178,7 +178,7 @@ module BABYLON {
                         this.releaseDrag();
 
                         // Reattach camera controls
-                        if(this.detachCameraControls && attachedElement && this._scene.activeCamera){
+                        if(this.detachCameraControls && attachedElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera){
                             this._scene.activeCamera.attachControl(attachedElement, true);
                         }
                     }

+ 2 - 2
src/Behaviors/Mesh/babylon.sixDofDragBehavior.ts

@@ -107,7 +107,7 @@ module BABYLON {
                         this.currentDraggingPointerID = (<PointerEvent>pointerInfo.event).pointerId;
 
                         // Detatch camera controls
-                        if(this.detachCameraControls && this._scene.activeCamera){
+                        if(this.detachCameraControls && this._scene.activeCamera && !this._scene.activeCamera.leftCamera){
                             if(this._scene.activeCamera.inputs.attachedElement){
                                 attachedElement = this._scene.activeCamera.inputs.attachedElement;
                                 this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement);
@@ -125,7 +125,7 @@ module BABYLON {
                         this._virtualOriginMesh.removeChild(this._virtualDragMesh);
                         
                         // Reattach camera controls
-                        if(this.detachCameraControls && attachedElement && this._scene.activeCamera){
+                        if(this.detachCameraControls && attachedElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera){
                             this._scene.activeCamera.attachControl(attachedElement, true);
                         }
                     }