Sfoglia il codice sorgente

Merge pull request #8015 from RaananW/WarnPeopleHttps

WebXR only available over https
David Catuhe 5 anni fa
parent
commit
273fc22cf5
2 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  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))
 - 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))
 - 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))
 - 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
 ### 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))
 - 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
 ### Maths
+
 - Added `Vector3.projectOnPlaneToRef` ([Deltakosh](https://github.com/deltakosh))
 - Added `Vector3.projectOnPlaneToRef` ([Deltakosh](https://github.com/deltakosh))
 
 
 ### Build
 ### Build

+ 9 - 0
src/XR/webXREnterExitUI.ts

@@ -3,6 +3,7 @@ import { Observable } from "../Misc/observable";
 import { IDisposable, Scene } from "../scene";
 import { IDisposable, Scene } from "../scene";
 import { WebXRExperienceHelper } from "./webXRExperienceHelper";
 import { WebXRExperienceHelper } from "./webXRExperienceHelper";
 import { WebXRState, WebXRRenderTarget } from './webXRTypes';
 import { WebXRState, WebXRRenderTarget } from './webXRTypes';
+import { Tools } from '../Misc/tools';
 /**
 /**
  * Button which can be used to enter a different mode of XR
  * 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 = document.createElement("div");
         this._overlay.style.cssText = "z-index:11;position: absolute; right: 20px;bottom: 50px;";
         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) {
         if (options.customButtons) {
             this._buttons = options.customButtons;
             this._buttons = options.customButtons;
         } else {
         } else {