소스 검색

WebXR only available over https

Raanan Weber 5 년 전
부모
커밋
3d61f64386
2개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      dist/preview release/what's new.md
  2. 9 0
      src/XR/webXREnterExitUI.ts

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

@@ -83,6 +83,7 @@
 - Support for pointer selection and teleportation in right handed systems ([#7967](https://github.com/BabylonJS/Babylon.js/issues/7967)) ([RaananW](https://github.com/RaananW))
 - Pointer Selection feature now uses `selectstart` and `selectend` events when gamepad and motion controller are not present ([#7989](https://github.com/BabylonJS/Babylon.js/issues/7989)) ([RaananW](https://github.com/RaananW))
 - Removed forced `autoClear` = false settings ([RaananW](https://github.com/RaananW))
+- Added a warning that WebXR can only be served over HTTPS ([RaananW](https://github.com/RaananW))
 
 ### Collisions
 
@@ -93,6 +94,7 @@
 - Added support for Additive Animation Blending. Existing animations can be converted to additive using the new MakeAnimationAdditive method for Skeletons, AnimationGroups and Animations. Animations can be played additively using the new isAdditive input parameter to the begin animation methods. ([c-morten](https://github.com/c-morten))
 
 ### Maths
+
 - Added `Vector3.projectOnPlaneToRef` ([Deltakosh](https://github.com/deltakosh))
 
 ### Build

+ 9 - 0
src/XR/webXREnterExitUI.ts

@@ -3,6 +3,7 @@ import { Observable } from "../Misc/observable";
 import { IDisposable, Scene } from "../scene";
 import { WebXRExperienceHelper } from "./webXRExperienceHelper";
 import { WebXRState, WebXRRenderTarget } from './webXRTypes';
+import { Tools } from '../Misc/tools';
 /**
  * Button which can be used to enter a different mode of XR
  */
@@ -83,6 +84,14 @@ export class WebXREnterExitUI implements IDisposable {
         this._overlay = document.createElement("div");
         this._overlay.style.cssText = "z-index:11;position: absolute; right: 20px;bottom: 50px;";
 
+        // if served over HTTP, warn people.
+        // Hopefully the browsers will catch up
+        if (typeof window !== 'undefined') {
+            if (window.location && window.location.protocol === 'http:') {
+                Tools.Warn('WebXR can only be served over HTTPS');
+            }
+        }
+
         if (options.customButtons) {
             this._buttons = options.customButtons;
         } else {