Search completed in 1.27 seconds.
1 results for "positionsensorvrdevice":
WebVR — Virtual Reality for the Web - Game development
Games › Techniques › 3D on the web › WebVR
Vukicevic from Mozilla and Brandon Jones from Google. For more info be sure to visit the MozVR.com and WebVR.info websites. Using the WebVR API The WebVR API is based on two concepts -- sending stereoscopic images to both lenses in your headset and receiving positional data for your head from the sensor, and those two are handled by HMDVRDevice (head-mounted display virtual reality device) and PositionSensorVRDevice. Get the devices To get information about devices connected to your computer, you can use the Navigator.getVRDevices method: 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] i...
... devices To get information about devices connected to your computer, you can use the Navigator.getVRDevices method: 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; } } } }); This code will loop through the available devices and assign proper sensors to the headsets -- the first devices array contains the connected devices, and a check is done to find the HMDVRDevice, and assign it to the gHMD variable -- using this you can set up...
...d devices, and a check is done to find the HMDVRDevice, and assign it to the gHMD variable -- using this you can set up the scene, getting the eye parameters, setting the field of view, etc. For example: function setCustomFOV(up,right,down,left) { var testFOV = new VRFieldOfView(up,right,down,left); gHMD.setFieldOfView(testFOV,testFOV,0.01,10000.0); } The gPositionSensor variable holds the PositionSensorVRDevice -- using this you can get the current position or orientation state (for example to update the scene view on every frame), or reset the sensor. For example, the below code outputs position information on the screen: function setView() { var posState = gPositionSensor.getState(); if(posState.hasPosition) { posPara.textContent = 'Position: x' + roundToTwo(posState.position.x) + " y" ...