THREE.VRController icon indicating copy to clipboard operation
THREE.VRController copied to clipboard

GearVR Controller Support?

Open jbroberg opened this issue 8 years ago • 13 comments

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

jbroberg avatar Jun 30 '17 03:06 jbroberg

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 :wink:

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 avatar Jul 06 '17 20:07 stewdio

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!

stewdio avatar Jul 08 '17 12:07 stewdio

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

  • Open https://stewdio.github.io/THREE.VRController/ on the built in browser
  • Click enter VR
  • The main button (clicking the trackpad) works. I can use it to drag the UI and interact with the elements.

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

jbroberg avatar Jul 19 '17 04:07 jbroberg

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

stewdio avatar Jul 19 '17 14:07 stewdio

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.

jbroberg avatar Jul 20 '17 01:07 jbroberg

I'll check this out presently.

mkeblx avatar Jul 28 '17 05:07 mkeblx

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 avatar Nov 27 '17 14:11 danrossi

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

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

danrossi avatar Jan 24 '18 13:01 danrossi

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

paulmasson avatar Aug 04 '18 20:08 paulmasson

@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?)

whatisor avatar Aug 18 '18 17:08 whatisor

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

paulmasson avatar Aug 18 '18 18:08 paulmasson

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 !

danrossi avatar Aug 19 '18 05:08 danrossi

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

whatisor avatar Aug 20 '18 07:08 whatisor