stewdio / THREE.VRController

Support hand controllers for Oculus, Vive, Windows Mixed Reality, Daydream, GearVR, and more by adding VRController to your existing Three.js-based WebVR project.
https://stewdio.github.io/THREE.VRController/
MIT License
229 stars 32 forks source link

threejs r89 not support? #10

Open jyy1082 opened 6 years ago

jyy1082 commented 6 years ago

I upgraded threejs to r89, the controller will not work. May I ask you to see this issue? Thank you so much!

stewdio commented 6 years ago

So r89 came out ... 2 days ago? ;)

If there is a compatibility issue with r89 can you take that on? (What are you seeing in the console? Was there a Three.js API update that broke VRController? If so, is it as simple as changing a property name to match the new API?) I haven’t had a chance to look at r89 yet but you say this happened when you upgraded—so everything was working fine for you in r88 or r87?

Also, can you please note the browser and VR rig you’re using? Is this for mobile? Desktop?

jyy1082 commented 6 years ago

r88 and r87 are work, but r89 has a error in Windows 10 and Firefox nightly:

image

stewdio commented 6 years ago

This looks like it is due to a fundamental change in how Three.js thinks about a VR headset’s standingMatrix. Here is the discussion about Three’s use of standing matrices in WebVR: https://github.com/mrdoob/three.js/issues/11619

And here is @mrdoob’s solution in practice: https://github.com/mrdoob/three.js/commit/3cb51d868ee279be373815de592fc072deffc82c

I’m currently working on a patch for VRController and the demo example so it can support Three.js r89 and above—but feel free to beat me to it with a pull request. I’m also migrating Space Rocks to r89 so that can serve as a more fleshed out example.

jyy1082 commented 6 years ago

Thanks a lot!

danrossi commented 6 years ago

It's implemented here but a possible bug. The controllers are too low now. Everything sits on the floor too I think

https://github.com/mrdoob/three.js/pull/13158

danrossi commented 6 years ago

This patch in the PR seems to make the controller above your head when standing up.

danrossi commented 6 years ago

Hi the standingmatrix code has been merged. However the original PR before changes I confirmed was working with VRController. Now I can't see the controller object unless I comment out the standingmatrix code for Daydream view.

See the test links here.

https://github.com/mrdoob/three.js/pull/13158#issuecomment-366208234

I have made an improved demo with an updating laser line and marker pointer also. I have also provided support for GearVR in my version. Should I do a PR for this ?

https://github.com/danrossi/THREE.VRController

danrossi commented 6 years ago

According to GearVR the controller is above the head. Possibly doubling of the matrix ?

danrossi commented 6 years ago

A forked branch fixes somethings that have been merged and causing problems with Daydream / Gear.

Here is the differences. It still has issues with height data when standing up. The entire floor and controller moves when standing up. It could be a problem still with VRController not sure.

https://jsfiddle.net/danrossi303/13onbkt0/ https://dev.electroteque.org/vrcontroller/raycast.html

fixed branch.

https://jsfiddle.net/danrossi303/orfktz0h/1/ https://dev.electroteque.org/vrcontroller/raycast2.html

danrossi commented 6 years ago

I have made fixes in my version for r91. I tried to get through to them regards to problem with DayDream based controllers but unfortunately the standing changes they made are set.

A work around is required by not setting a standing matrix for DayDream / GearVR.

My version supports GearVR also. Will update tests eventially.

here is where the fix needs to be made.

https://github.com/danrossi/THREE.VRController/blob/master/VRController.js#L484

danrossi commented 6 years ago

example of all fixes in that branch and current three.js is here

http://dev.electroteque.org/vrcontroller/raycast.html

danrossi commented 6 years ago

An example implementation with a laser pointer and fallback gaze control is here.

https://github.com/danrossi/three-vr-controls/blob/master/src/VRControls.js

bhautikj commented 5 years ago

Another example with fixes; this one works with THREE r95 on the Oculus Go: https://github.com/bhautikj/THREE.CommonClicker

Short summary of fixes: