aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.58k stars 3.94k forks source link

[1.0.0][Chrome m79] Gyro not working - device orientation not taken into account #4355

Closed MK-LucidWeb closed 4 years ago

MK-LucidWeb commented 4 years ago

Description:

Device orientation is not taken into account anymore in non-VR mode (aka magic window).

Works on Chrome m78, breaks in m79.

Tested on

Logging the deviceorientation event produces correct result.

document.addEventListener('deviceorientation', console.log);
dmarcos commented 4 years ago

Any errors on console?

MK-LucidWeb commented 4 years ago

Any errors on console?

image

aframe.io-1576520442513.log

Unfortunately, nothing about that...

A quick search for deviceorientation in the repo yields nothing, is ThreeJS handling everything? Maybe it's worth a repro with ThreeJS.

Going back to previous commits doesn't solve the issue.

MK-LucidWeb commented 4 years ago

For comparison, https://threejs.org/examples/misc_controls_deviceorientation.html works in Chrome m79.

MK-LucidWeb commented 4 years ago

If anyone wants to take a shot at it before I do, here are some starting points:

  1. https://github.com/mrdoob/three.js/blob/master/examples/misc_controls_deviceorientation.html
  2. https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/controls/DeviceOrientationControls.js
  3. https://github.com/aframevr/aframe/blob/master/src/components/camera.js#L44
MK-LucidWeb commented 4 years ago

Orientation used to be handled by webvr-polyfill but we don't use it anymore in Chrome m79? That's why it's not working in Chrome m79 but works fine in other browsers.

Fixing it on our side, already got a working build but we still need to do testing, PR will be submitted tomorrow.

dmarcos commented 4 years ago

Magic window tracking is also using the Polyfill and only enabled when WebXR is not available. After Chrome m79, ARCore devices come with WebXR enabled so we have to make sure the Polyfill also kicks in that case.

manitito commented 4 years ago

If you disable flag "WebXR Device API" m79 - then gyro is working

MK-LucidWeb commented 4 years ago

If you disable flag "WebXR Device API" m79 - then gyro is working

It works if you disable WebXR because then it uses the polyfill. It's not a proper fix though as you just can't ask all end users to disable the WebXR API. It's also counter productive as the goal is to support the actual WebXR spec.