Skip to content
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

GearVR Controller Support? #5

Open
jbroberg opened this issue Jun 30, 2017 · 13 comments
Open

GearVR Controller Support? #5

jbroberg opened this issue Jun 30, 2017 · 13 comments

Comments

@jbroberg
Copy link

jbroberg commented Jun 30, 2017

I know this is not specifically mentioned as supported, but I tried out the GearVR Controller with a GearVR and a Samsung S6.

Trying the demo page on this project, I got the following results:

  • Using the new(ish) built in Internet browser on Oculus home - the controller is visible and tracks/points well, but none of the buttons work - I can't interact with the UI elemental via clicking.
  • Using Samsung Internet with WebVR enabled, I get a black screen when loading the page.

Let me know if there is any useful debugging info I can provide for this controller.

Cheers! - James

@stewdio
Copy link
Owner

stewdio commented Jul 6, 2017

I would love to support the GearVR controller! This may be a bit of a pain, but can you download and open Chrome on your phone, plug your phone into your computer, then connect your phone’s open Chrome tab to your computer’s like so: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/

Once you do that you can interact with the JavaScript console. Load up the demo site and then in your console paste and enter this to enable full verbose mode: THREE.VRController.verbosity = 1

Now when you interact with the trackpad or buttons you should get a lot of output in the console. What you need to do is interact with each piece of the controller and see what button index # is receiving that interaction. My guess is the thumpad has a touch, a press, and axes and is index #0. See if that’s what’s showing up in the console and also check out the other buttons. We can use that info to add in explicit support 😉

Try to be thorough and keep notes. It’s the subtleties that make all the difference! (Does this button have a press state? A touch state? An analog value—and if so at what point does a press begin and is that the same threshold for ending a press? Does +1 on the Y axis mean top or bottom? And so on.) Here’s what I did as an example:
https://github.com/stewdio/THREE.VRController/blob/master/VRController.js#L451

@stewdio
Copy link
Owner

stewdio commented Jul 8, 2017

I also just made a super tiny update that should allow your GearVR primary button to work with the example’s "primary press began" event listener even though we haven’t explicitly mapped the buttons yet:
https://github.com/stewdio/THREE.VRController/blob/master/VRController.js#L95

If you can, give that a go and tell me if it works. It makes a pretty big assumption that the primary button is going to be at index === 0 in the buttons array but that’s what I’m seeing with the Vive, Oculus, and Daydream ... so I’m hoping that’s the norm!

@jbroberg
Copy link
Author

I haven't done the full logging yet, but I can confirm I can now:

The button does not work outside VR mode but this is probably expected.

@stewdio
Copy link
Owner

stewdio commented Jul 19, 2017

Wow that is awesome! (Thank you for testing it out!)

When you say the button does not work outside VR mode, are you able to see the controller at all before entering VR? If you don’t see it at all then I think what might be happening is that prior to calling vrDisplay.requestPresent() the GearVR does not engage its VR internals and connect to the controller. (But this is just a guess! It would be similar to how Daydream seems to operate.)

@jbroberg
Copy link
Author

I can see the controller outside the VR mode, but what I am seeing is the GearVR interface and their rendered representation of the controller. The browser is just a floating window inside the GearVR interface/UI.

I can point to items in the scene, they highlight the item I am pointing at them (e.g. the dat.guiVR floating menu) but the click is ineffective on the scene - I can't click the elements, drag the UI, etc - when outside VR mode.

Within VR mode everything works as expected. I guess the above is not that surprising but just an observation.

@mkeblx
Copy link

mkeblx commented Jul 28, 2017

I'll check this out presently.

@danrossi
Copy link

I had to fork this project to start working on GearVR support. it should work like the DayDream one. So this makes the thumbpad the primary not the trigger.

'Gear VR Controller': {

		style: 'gearvr',


		//  THUMBPAD
		//  Both a 2D trackpad and a button with both touch and press. 
		//  The Y-axis is “Regular”.
		//
		//              Top: Y = -1
		//                   ↑
		//    Left: X = -1 ←─┼─→ Right: X = +1
		//                   ↓
		//           Bottom: Y = +1
		
		axes: [{ name: 'thumbpad', indexes: [ 0, 1 ]}],
		buttons: [ 'thumbpad' ],
		primary: 'thumbpad'
	},

@danrossi
Copy link

Should I do a PR for this change ? It is working with GearVR

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

@paulmasson
Copy link
Contributor

@danrossi are you still planning to do a PR to add this support? I added Oculus Go yesterday and can do this as well if you no longer want to do so.

@whatisor
Copy link

@paulmasson I am using Oculus Go with this controller:
https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/#unity-ovrinput-go-controller
However, I cannot find which event for touchpad event (touch position or swipe action?)

@paulmasson
Copy link
Contributor

@whatisor if you have the Go connected to your computer and have set THREE.VRController.verbosity = 1 in the Chrome JavaScript console, then you'll see all the events. You're probably looking for thumbpad axes changed.

@danrossi
Copy link

Another one to add support for ! I will look at adding a PR. However I think I may have made more modifications to mine and looking at complete refactor to Es6 so I can import it property into a three.js bundle !

@whatisor
Copy link

whatisor commented Aug 20, 2018

@paulmasson Thank you, I found it as "axes changed" from aframe sample.

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

No branches or pull requests

6 participants