Jump to content
  • Advertisement
Sign in to follow this  
kuroro_san

Prevent Camera Flip on [-90,90] rotation

This topic is 459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So i'm using the html5 deviceorientation API to get device euler rotation values alpha, beta, gamma, and I want to use the gamma value to rotate a webgl scene on my phone.  The scene rotates fine when I move the value within that range. However, once I go beyond -90 for example (happens when I point my phone upward), the next gamma value I get is 89. This has the effect on making the scene suddenly flipping and looking down instead of 1 more degree upwards. 

Question is. Is there a way to normalize the value such that the jump from -90 to 89 is treated as looking 1 more degree upwards ?

Share this post


Link to post
Share on other sites
Advertisement

I am not sure what the value "gamma" is supposed to represent, but perhaps you can figure that out and then compute your rotation in a more direct manner, skipping the Euler angles altogether. Code that uses linear algebra instead of angles is generally simpler and more robust.

 

Edited by alvaro

Share this post


Link to post
Share on other sites

I looked at the documentation for the deviceorientation API.  You won't be able to use gamma alone.

I think you're going to have to use alpha, beta, AND gamma to construct complete rotation information.

I found this which might help, if you understand the math he's using:  https://stackoverflow.com/questions/36639182/html5-get-device-orientation-rotation-in-relative-coordinate

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!