Explorar o código

force XR if no VR is present

Raanan Weber %!s(int64=5) %!d(string=hai) anos
pai
achega
40573b1b08
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      src/Cameras/VR/vrExperienceHelper.ts

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

@@ -714,6 +714,14 @@ export class VRExperienceHelper {
         this._scene = scene;
         this._inputElement = scene.getEngine().getInputElement();
 
+        // check for VR support:
+
+        const supportsVR = 'getVRDisplays' in navigator;
+        // no VR support? force XR
+        if (!supportsVR) {
+            webVROptions.useXR = true;
+        }
+
         // Parse options
         if (webVROptions.createFallbackVRDeviceOrientationFreeCamera === undefined) {
             webVROptions.createFallbackVRDeviceOrientationFreeCamera = true;