I'm trying to get Oculus Rift DK2 orientation input working with WebVR - either using Three.js' VRControls (examples/js/controls/VRControls.js
) or directly from the PositionSensorVRDevice
.
But the PositionSensorVRDevice
's state values orientation
and position
are always either null
(Firefox) or VRPoint3D/4Ds with x,y,z = 0 (Chrome), so the camera orientation never changes.
The Firefox and Chrome VR builds I've been trying are:
It is getting hold of a PositionSensorVRDevice OK, although it looks like it may not be the real one, because Chrome reports it as:
- deviceId: debug-0
- deviceName: Moculus Rift
- hardwareUnitId: debug-0
And FF reports it as:
- deviceId: somedevid
- deviceName: HMD Position Device
- hardwareUnitId: unknownHMDInfo-0x1351d4000
I get the same result with the Leap Motion VR Quickstart demo and the Three.js WebGL Effects VR demo. I also get the same with a demo I did a couple of months back which used to work - it doesn't use VRControls, but deals with the PositionSensorVRDevice directly.
Needless to say the Rift is all hooked up and the Demo Scene from the Oculus Rift Config Util is working fine. I'm on Firmware version 2.12.
The relevant code in VRControls is the update method - I've been checking the values of state.orientation
and state.position
here:
this.update = function () {
if ( vrInput === undefined ) return;
var state = vrInput.getState();
if ( state.orientation !== null ) {
object.quaternion.copy( state.orientation );
}
if ( state.position !== null ) {
object.position.copy( state.position );
}
};
Any suggestions gratefully received!
Oops, turns out I wasn't on the latest version of the Oculus runtime! I was on v0.4.1 - I needed to upgrade to the 0.4.3 beta. Working fine now in the latest VR builds of FF and Chrome.
In case it helps anyone else - I found which version I needed from Vlad's post on the web-vr mailing list.