Skip to content

Update with support for WebVR "1.1" - #9655

Merged
mrdoob merged 3 commits into
mrdoob:devfrom
toji:webvr_1_1
Sep 9, 2016
Merged

mrdoob merged 3 commits into
mrdoob:devfrom
toji:webvr_1_1

Conversation

@toji

@toji toji commented Sep 9, 2016

Copy link
Copy Markdown
Contributor

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.

toji and others added 3 commits September 8, 2016 20:12
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.
@mrdoob
mrdoob merged commit 6280a45 into mrdoob:dev Sep 9, 2016
@mrdoob

mrdoob commented Sep 9, 2016

Copy link
Copy Markdown
Owner

Thanks!

@mrdoob

mrdoob commented Sep 9, 2016

Copy link
Copy Markdown
Owner

I guess this file also needs some updating?
https://github.com/mrdoob/three.js/blob/dev/examples/js/WebVR.js

@toji

toji commented Sep 9, 2016

Copy link
Copy Markdown
Contributor Author

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.

@mflux

mflux commented Sep 21, 2016

Copy link
Copy Markdown

Any updates on this? Seems like using the latest THREE.ViveController will give:

Cannot read property 'position' of undefined

upon doing

var pose = gamepad.pose;

@toji

toji commented Sep 21, 2016

Copy link
Copy Markdown
Contributor Author

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.)

@mflux

mflux commented Sep 21, 2016

Copy link
Copy Markdown

Ohhhh that's what that issue was. Right, thanks, I remember reading that in the release docs now.

@mflux

mflux commented Sep 21, 2016

Copy link
Copy Markdown

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.

@toji

toji commented Sep 21, 2016

Copy link
Copy Markdown
Contributor Author

It should probably just check for if (!gamepad.pose). It'll be undefined if the flag isn't flipped (which should be a temporary thing ultimately) and null if the gamepad has no pose to report.

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.

@mflux

mflux commented Sep 21, 2016

Copy link
Copy Markdown

Oh that's a good point. Will update the issue.

@mflux

mflux commented Sep 21, 2016

Copy link
Copy Markdown

Strangely, if ( gamepad !== undefined && !gamepad.pose ) doesn't actually work and I've no idea why.

aardgoose pushed a commit to aardgoose/three.js that referenced this pull request Oct 7, 2016
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants