You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similarly, I'm happy if we can somehow control headset pose in JavaScript.
The background of this request is we've been developing WebXR emulator extension which emulates XR devices in JavaScript and I'm trying to integrate with webxr-polyfill. I need a way to control headset in JavaScript to accomplish the emulation.
The text was updated successfully, but these errors were encountered:
To simulate a headset, it's possible to create your own "XRDevice" (like CardboardXRDevice and WebVRDevice) that provides its pose via the abstraction API, similar to how AR viewers can use the webxr-polyfill to connect to ARKit/ARCore (like Mozilla's webxr-viewer). The extension would have to wire up the polyfill with the device, similar to src/WebXRPolyfill.js here; some notes on extending the polyfill #56
Thanks for the comment. WebXRPolyfill creates device here so it seems we can extend WebXRPolyfill and override _patchNavigatorXR() to create custom device.
classMyWebXRPolyfillextendsWebXRPolyfill{_patchNavigatorXR(){letdevicePromise=newCustomXRDevice(this.global,this.config);// the following is duplicated with WebXRPolyfill._patchNavigatorXR()this.xr=newXR(devicePromise);Object.defineProperty(this.global.navigator,'xr',{value: this.xr,configurable: true,});}}
If we move requestXRDevice() in WebXRPolyfill class the duplicated code in MyWebXRPolyfill may be removed.
As written in the readme
Input can be controlled with Gamepad API by hacking
navigator.getGamepads()
in JavaScript (I'm not sure if it's recommended tho).Similarly, I'm happy if we can somehow control headset pose in JavaScript.
The background of this request is we've been developing WebXR emulator extension which emulates XR devices in JavaScript and I'm trying to integrate with webxr-polyfill. I need a way to control headset in JavaScript to accomplish the emulation.
The text was updated successfully, but these errors were encountered: