Giter Club home page Giter Club logo

Comments (7)

scottgarner avatar scottgarner commented on May 17, 2024

My temporary workaround for this was to apply the screen rotation Q in resetPose.

  this.resetQ.copy(this.filter.getOrientation());
  this.resetQ.multiply(this.worldToScreenQ);

Unfortunately, that wouldn't work on Android because of the screen locking stuff. It seems that window.orientation just gives the locked orientation (with no indication that it is indeed locked), so the rotation was wrong if you entered VR mode form anything other than landscape-primary.

My workaround there was to just disable screen locking, though then I had to mess with the instructions display to make it work with the fullscreen wrapper.

from webvr-polyfill.

scottgarner avatar scottgarner commented on May 17, 2024

Just to clarify this issue, it happens only when starting in landscape mode—"forward" appears 90 degrees to the left or right depending on device orientation.

from webvr-polyfill.

scottgarner avatar scottgarner commented on May 17, 2024

I've tinkered with this a bit more and still haven't come to a satisfactory solution.

To summarize, the initial world transformation should account for the device orientation, as should calls to resetPose. Unfortunately, when the orientation is locked on Android, it always returns the locked value, not the true orientation, which makes it difficult to account for.

I'm not sure how to fix this without knowing the "true" orientation.

from webvr-polyfill.

zazabe avatar zazabe commented on May 17, 2024

We are using a "preparation" step to access the VR mode:

  • unlock the orientation (if it was locked)
  • display some instructions, asking the user to turn his phone
  • detect orientation changes and only display the button to enter VR when the phone is in landscape
  • when the user click on the button, reset the device sensor + do all the VR stuff (fullscreen, orientation lock, distortion, etc...)

We have a trick to detect the orientation even if it's locked at the OS level, we use the event.accelerationIncludingGravity.y value on devicemotion, the phone should be in landscape when the value is around 0 (it works only if the phone is perpendicular to the earth actually)...

We are still using an old version of the WebVR polyfill, without the requestPresent method, but anyhow, those steps have to be done before entering VR, so before requestPresent.

from webvr-polyfill.

borismus avatar borismus commented on May 17, 2024

I addressed this slightly, but it's still not perfect. c6720ed

from webvr-polyfill.

borismus avatar borismus commented on May 17, 2024

Alright, should be fixed now: 716f8a1

from webvr-polyfill.

scottgarner avatar scottgarner commented on May 17, 2024

Great news! Thanks!

from webvr-polyfill.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.