Update with support for WebVR "1.1" #9655
Conversation
I'd be shocked if anyone was still attempting to use the browser builds that the old code path was supporting.
Since some view matrices may include orientations as well as translations we need to extract the head-to-eye transforms from the view matrices to ensure accurate results. This isn't normally necessary but is required in THREE.js because the camera is already transformed into the head position with the VRController.
Thanks! |
I guess this file also needs some updating? |
I guess that isLatestAvailable should probably check for something else, like the presence of VRFrameData. We can probably also strip out the checks for the older API. I can put up another pull request for that tomorrow. |
Any updates on this? Seems like using the latest THREE.ViveController will give: Cannot read property 'position' of undefined upon doing
|
If you're using Chrome with the WebVR 1.1 builds you'll need to go into about:flags and turn on "Gamepad Extensions". Yeah, that sucks. Sorry. I'm gonna work out a system where that's not necessary soon. It's just a side effect of trying to upstream everything into Chrome proper. (Though this does make me think that I should simply not expose the Vive wands at all if the flag isn't flipped. Would be less confusing that way.) |
Ohhhh that's what that issue was. Right, thanks, I remember reading that in the release docs now. |
Since this changed, there's an additional issue where THREE.ViveController is checking if gamepad.pose == null when it should be checking against undefined, I'll tag that as an issue. |
It should probably just check for And no worries about forgetting the flag. I've only done that about 10 times myself, and I'm the one who put the flag in there. :P My goal is to get away from flag flipping as fast as possible. |
Oh that's a good point. Will update the issue. |
Strangely, if ( gamepad !== undefined && !gamepad.pose ) doesn't actually work and I've no idea why. |
* Updating VREffect and VRControls to support WebVR 1.1 * Stripped out really old WebVR code path that's no longer used. I'd be shocked if anyone was still attempting to use the browser builds that the old code path was supporting. * Ensured that VREffect uses the right eye transforms Since some view matrices may include orientations as well as translations we need to extract the head-to-eye transforms from the view matrices to ensure accurate results. This isn't normally necessary but is required in THREE.js because the camera is already transformed into the head position with the VRController.
These changes enable VREffect and VRControls to use the newly recommended WebVR best practices when the updated version of the API is detected.
Also took the opportunity to remove the really old code path because I don't think anyone is actually using it anymore. The browsers that it supported have all been updated to at least the WebVR 1.0 spec.