Touch events not working in VR mode

Hey guys, I’m currently developing VR video player for a client and encountered an issue: all touch events not fired when I enable VR mode (everything works good before and after VR).

There’s a topic already about this case — and without any solution: WebVR cardboard input

Is it a bug? Where should I dig to?

AFAIK, It will not work as a touch device when you enter into VR mode.
For interactivity you may need to use VR pointers.

To avoid the problem and be crossbrowser, I use the google webvrpollyfill and touch event works with it.

But for the future, touch event will not work, in fact you need to use the gamepad api to get the user interaction.

Yes, i know about that polyfill, but it only emulates vr display when WebVR flag in chrome://flags is disabled. Otherwise polyfill does nothing (well, it is its purpose — to emulate API only when needed).

I want to get touch events to work with native WebVR (i.e. when WebVR flag is enabled). I know that it’s possible because in this game it works as it should.

What else is there to check?

Anyway this flag would never be activated by user, there its enabled only with the chrome hack.
I think that the game in your example use the gamepad api, touch event are disabled when there’s a vrdisplay with a real VR context, its in the specification to prevent the user to touch accidentaly the screen while he put the phone in the cardboard (as i undestand).

You can try the borismus ray input library but i think that will not work with the webvr flag activated for the touch events.

Wait, what do you mean? I don’t have any joystick or similar device, I just enter VR mode, point the camera at the button (see attached picture), tap the screen and voila, button is pressed.

Or is there a way to utilize gamepad events to enable touch input?

Regarding the WebVR flag: yes, I know that user will never turn it on by himself, but I guess some day it will be enabled by default? I just wanna be ready :slight_smile:

I think, never tested it, that when webvr flag is active touch events aren’t fired but they’re redirected to the gamepad api
I understand but when the VR will be finally ready to be released in browsers the specification will probably have changed.