Three.js: Allow for selection between multiple VRDevices

Created on 2 May 2016  路  5Comments  路  Source: mrdoob/three.js

Description of the problem

Currently sets to first device found.

Three.js version
  • [x] Dev
  • [ ] r76
  • [ ] ...

    Browser
  • [ ] All of them

  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
  • [x] Chromium VR (webvr.info)

    OS
  • [] All of them

  • [x] Windows
  • [ ] Linux
  • [ ] Android
  • [ ] IOS
    Hardware Requirements (graphics card, VR Device, ...)

With both Oculus CV1 and HTC Vive connected, both enumerate as devices, but we should present some kind of UI to select between the devices.

Most helpful comment

Just FYI: this issue can probably be closed (and deferred until WebXR spec changes to allow multiple devices, but it probably won't any time soon).

So, in WebXR (the sucessor to WebVR v1.1): navigator.getVRDisplays().then(displays => { enterVR(displays[0]) }) is to be replaced with navigator.xr.requestDevice(device => { enterVR(device) })

The Chrome team got this working actually behind a flag already. Check it out, and these examples, and look who's contributed! :smile:

All 5 comments

The WebVR Polyfill needs to change to support this too.

This affects both VREffect and VRControls. FWIW, VRControls used to support multiple devices but for WebVR v1.0 support, VRControls was changed to allow only the first one.

VRControls and VREffect are now deprecated. navigator.getVRDisplays() is only called in /examples/js/vr/WebVR.js and thus outside of the core.
https://github.com/mrdoob/three.js/blob/a39c258cb5398cb56a9af3f1a05e0544991f686a/examples/js/vr/WebVR.js#L102-L115
In the interests of simplification, the examples always use the first available device and i think that's okay. An UI for selecting the device should be implemented on app level.

Just FYI: this issue can probably be closed (and deferred until WebXR spec changes to allow multiple devices, but it probably won't any time soon).

So, in WebXR (the sucessor to WebVR v1.1): navigator.getVRDisplays().then(displays => { enterVR(displays[0]) }) is to be replaced with navigator.xr.requestDevice(device => { enterVR(device) })

The Chrome team got this working actually behind a flag already. Check it out, and these examples, and look who's contributed! :smile:

and look who's contributed! 馃槃

image
Took me awhile to spot what the exactly the change was but indeed the contribution is legit 馃槀

Was this page helpful?
0 / 5 - 0 ratings