-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headset control API #94
Comments
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 |
Thanks for the comment. class MyWebXRPolyfill extends WebXRPolyfill {
_patchNavigatorXR() {
let devicePromise = new CustomXRDevice(this.global, this.config);
// the following is duplicated with WebXRPolyfill._patchNavigatorXR()
this.xr = new XR(devicePromise);
Object.defineProperty(this.global.navigator, 'xr', {
value: this.xr,
configurable: true,
});
}
} If we move class MyWebXRPolyfill extends WebXRPolyfill {
requestXRDevice() {
return new CustomXRDevice(this.global, this.config);
}
} What do you think? |
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: