New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with support for WebVR "1.1" #9655

Merged
merged 3 commits into from Sep 9, 2016

Conversation

Projects
None yet
3 participants
@toji
Contributor

toji commented Sep 9, 2016

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 added some commits Sep 9, 2016

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.

@mrdoob mrdoob merged commit 6280a45 into mrdoob:dev Sep 9, 2016

@mrdoob

This comment has been minimized.

Owner

mrdoob commented Sep 9, 2016

Thanks!

@mrdoob

This comment has been minimized.

Owner

mrdoob commented Sep 9, 2016

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

@toji

This comment has been minimized.

Contributor

toji commented Sep 9, 2016

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

This comment has been minimized.

mflux commented Sep 21, 2016

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

This comment has been minimized.

Contributor

toji commented Sep 21, 2016

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

This comment has been minimized.

mflux commented Sep 21, 2016

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

@mflux

This comment has been minimized.

mflux commented Sep 21, 2016

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

This comment has been minimized.

Contributor

toji commented Sep 21, 2016

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

This comment has been minimized.

mflux commented Sep 21, 2016

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

@mflux

This comment has been minimized.

mflux commented Sep 21, 2016

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

aardgoose added a commit to aardgoose/three.js that referenced this pull request Oct 7, 2016

Update with support for WebVR "1.1" (mrdoob#9655)
* 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