Closed cjnowotarski closed 1 year ago
Hi! I'll look into this when I have the chance, but it may be a while. To get a quicker answer you may want to post on Stack Overflow, as there are more people to answer there. :)
I am having similar problems it seems the onTouchStart
in touch-controls
doesnt fire in Chrome on Android.
I have tested on Edge and Firefox for Android and also Safari for iOS and its working great.
Its possibly related to the UI Google Play VR Services
adds ontop of the webpage?
I haven't tested that feature (yet) in this repo directly, but getting that touch control event on the cardboard is hard. I did finally find a repo that did it, was planning to dig into it later and figure out how it did so and add it.
https://dougreeder.github.io/aframe-button-controls/example.html
Thanks for the info @kylebakerio ! I'm having this problem at the moment only with chrome on android mobile. Chrome with iOS works fine. I imagine it's due to the fact Chrome on android does not use the pollyfill?
Did you manage to integrated that working example? Strange how it don't work out the box for chrome / android!
I did test it just now in chrome/android, and it worked for me.
I haven't integrated it into my project yet, though--I thought I had, but hadn't touched that project in months and just came back to it a few days ago, finally tested it and found it wasn't working. I have stare-to-click functionality and bluetooth gamepad functionality for cardboard currently working, though. At some point I dug somewhat deep into this issue, and did integrate that whole library and use it as the foundation to link all of my various interface options into a single control scheme.
I just tested his example, though, on my android. it shows 'gaze 0 buttondown' when I touch the screen in cardboard mode, otherwise 'gaze 0 buttonup' when I release/am not pressing. When not in cardboard VR mode, it shows 'screen 0 buttondown' and 'screen 0 buttonup'.
AFRAME.scenes[0].xrSession.inputSources[0]
will be populated as an XR controller with one button when you go into cardboard mode (the somewhat confusingly named 'gaze' controller). For me, in my own app using his library, I do seem to get gaze 0 to fire once as soon as I enter VR mode, but I think the button seems to be acting like it is 'held down'. Not sure, been troubleshooting it for hours now, hadn't gone back to this in a while. But it definitely seem possible, and could be done without his library using this knowledge.
I think I've hit a glitch in his library, as I've been walking through the code by hand really carefully. I'm close to figuring it out, but as a result, I also found out a quick and dirty way to get access to cardboard button down/up--just use this:
AFRAME.scenes[0].xrSession.addEventListener('selectstart', () => console.log("down"));
AFRAME.scenes[0].xrSession.addEventListener('selectend', () => console.log("up"));
(you'll need to only add that listener once you're already in VR mode I imagine--you'll need an existing xrSession)
==
one other quick note: that demo page does 'crash' for me the first time I click 'VR'--but as soon as I back out, and then enter back into VR, it works.
also, found the bug. this.addSessionEventListeners();
wasn't firing on my site for some reason. I'll make a bug report on his library and probably a pull request.
So, basically, it seems like the 'gaze' psuedo controller is an incomplete implementation at the browser level; it just doesn't include 'gamepad' information that reveals what button is pressed at any given time like 'normal' controllers. I suppose it was never fully updated with the webXR spec and is still designed to operate with events a la the old webVR spec, perhaps? Is that right? I'm not 100% sure on guessing at the history of this neglected part of the browser standard, but it looks like it will be necessary to 'mix styles' to allow cardboard functionality. In other words, it seems impossible to poll the gaze controller to get button status, even though you can see the controller there. The only thing you can do is use the selectstart
and selectend
events for the cardboard button.
Cardboard button for Chrome Android was fixed in #386
I have a little a-frame scene set up using movement-controls. Forward motion works fine on full screen with keyboard controls, and touch control used to work with a mobile phone in a headset. I reconfigured google chrome to improve the customization between my phone and cardboard using chrome://flags/#enable-webvr but now the touch control in VR mode no longer works... any pointers? Code is at supercell.glitch.me