31. (HMD) VR Device
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof HMDVRDevice) {
gHMD = devices[i];
break;
}
}
32. Position Sensor
// If device found, get Position Sensor.
if (gHMD) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof PositionSensorVRDevice
&& devices[i].hardwareUnitId === gHMD.hardwareUnitId)
{
gPositionSensor = devices[i];
break;
}
}
}
33. Position State
var posState = gPositionSensor.getState();
if (posState.hasPosition) {
posPara.textContent = 'Position: x' + (posState.position.x) +
' y' + (posState.position.y) +
' z' + (posState.position.z);
}
if (posState.hasOrientation) {
orientPara.textContent = 'Orientation: x' + (posState.orientation.x) +
' y' + (posState.orientation.y) +
' z' + (posState.orientation.z);
}
35. Field Of View
function setCustomFOV(up, right, down, left) {
var testFOV = new VRFieldOfView(up, right, down, left);
gHMD.setFieldOfView(testFOV, testFOV, 0.01, 10000.0);
var lEye = gHMD.getEyeParameters('left');
var rEye = gHMD.getEyeParameters('right');
console.log(lEye.currentFieldOfView);
console.log(rEye.currentFieldOfView);
}
62. – http://vizor.io/
„You don’t need to be a game developer to create VR
content on the web. With Vizor's visual editor,
anyone can create and share their own VR
experiences in a web browser, and it’s free.“
69. WebVR is amazing…
… but it’s not ready
(Editors Draft, Browser support)
… and has high Hardware Requirements!
… HMD Devices are not cheap.
(Except: Google Cardboard)
… and it’s a pleasure to create content!