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

WIP: Use THREE.DeviceOrientationControls when webvrpolyfill is not used #4355 #4361

Conversation

MK-LucidWeb
Copy link
Contributor

@MK-LucidWeb MK-LucidWeb commented Dec 18, 2019

Description:
Device orientation is not taken into account anymore on Chrome m79 (related to issue #4355).

The component look-controls uses PolyfillControls

See:
look-controls.js:34
device.js:189

  • In device.js, first it retrieves the VR display using the polyfill
var vrDisplay = window.webvrpolyfill && window.webvrpolyfill.getPolyfillDisplays()[0];
  • Then in PolyfillControls#update, a check to see if there is a vr display. If there is none, it short circuits.
if (!vrDisplay) { return; }
  • As the polyfill is not used in Chrome m79, it always short circuits.

This PR tries to change the working logic as little as possible.

Changes proposed:

  • Import super-three/examples/js/controls/DeviceOrientationControls into THREE namespace
  • look-controls: Check if we are using webpolyfillvr
  • look-controls: if there is no webpolyfillvr, then fallback on THREE.DeviceOrientationControls

Questions:

  • Should we change the name of polyfillControls and polyfillObject?
  • Is checking for window.webvrpolyfill presence enough?

@MK-LucidWeb
Copy link
Contributor Author

MK-LucidWeb commented Dec 18, 2019

This needs thorough testing, imho.

Edit:// also checking why the tests are failing
Edit2:// seems like it messes with the initial camera rotation. This needs to be fixed.

@MK-LucidWeb MK-LucidWeb changed the title Use THREE.DeviceOrientationControls when webvrpolyfill is not used #4355 WIP: Use THREE.DeviceOrientationControls when webvrpolyfill is not used #4355 Dec 18, 2019
@dmarcos
Copy link
Member

dmarcos commented Dec 19, 2019

Thanks, it makes sense to use DeviceOrientationControls for magic window mode. I took your logic, made some minor changes and used DeviceOrientationControls without the DeviceOrientationEvent.requestPermission logic that we handle separately. Congrats on your first contribution 🥇

@dmarcos
Copy link
Member

dmarcos commented Dec 19, 2019

Close in favor of #4363

@mako-lw I tested on Android and iOS devices and it's working my side. Let me know if the issue is resolved. We can adjust if necessary.

@dmarcos dmarcos closed this Dec 19, 2019
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

Successfully merging this pull request may close these issues.

2 participants