Skip to content

Instantly share code, notes, and snippets.

@DigiTec
Last active December 20, 2015 23:13
Show Gist options
  • Save DigiTec/0587a2ce5ff86ce29726 to your computer and use it in GitHub Desktop.
Save DigiTec/0587a2ce5ff86ce29726 to your computer and use it in GitHub Desktop.
Breakouts of the WebVR specification for embedding
partial interface Navigator
{
Promise<sequence<VRDevice>> getVRDevices();
}
var gHMD, gPositionSensor;
navigator.getVRDevices().then(function(devices) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof HMDVRDevice) {
gHMD = devices[i];
break;
}
}
if (gHMD) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof PositionSensorVRDevice && devices[i].hardwareUnitId === gHMD.hardwareUnitId) {
gPositionSensor = devices[i];
break;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment