Browse Source

Merge pull request #6302 from TrevorDev/vrFallbackCameraClicking

support clicking when using the fallback vr camera
David Catuhe 6 years ago
parent
commit
a37ef0ea5f
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/Cameras/VR/vrExperienceHelper.ts

+ 13 - 0
src/Cameras/VR/vrExperienceHelper.ts

@@ -819,6 +819,19 @@ export class VRExperienceHelper {
         this._circleEase = new CircleEase();
         this._circleEase = new CircleEase();
         this._circleEase.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);
         this._circleEase.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);
 
 
+        // Allow clicking in the vrDeviceOrientationCamera
+        scene.onPointerObservable.add((e) => {
+            if (this._interactionsEnabled) {
+                if (scene.activeCamera === this.vrDeviceOrientationCamera && (e.event as PointerEvent).pointerType === "mouse") {
+                    if (e.type === PointerEventTypes.POINTERDOWN) {
+                        this._cameraGazer._selectionPointerDown();
+                    }else if (e.type === PointerEventTypes.POINTERUP) {
+                        this._cameraGazer._selectionPointerUp();
+                    }
+                }
+            }
+        });
+
         if (this.webVROptions.floorMeshes) {
         if (this.webVROptions.floorMeshes) {
             this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes });
             this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes });
         }
         }