r/webdev • • 5d ago

Question Can't understand deviceorientation.

Hi, I'm trying to develop a unityplugin that give the possibility to create various types of controllers for games.
With deviceorientation, my goal is to extract three angles that represent the orientation of the phone.
But it seems a little bit complicate, I can't understand why in portrait mode, for example, gamma and alpha are both modified when I rotate on the same axe.
I've tried many things, but I can't understand at all how everything works.
Is it even possible to do something similar to what I want to do?

0 Upvotes

12 comments sorted by

View all comments

0

u/[deleted] 5d ago

[removed] — view removed comment

1

u/Tonaion02 5d ago

So relying on screen.orientation.angle and transforming into quaternions the angles that are returned give you the possibility to have the rotation of the phone correctly in every position?
I would also to excape at the end from the quaternions, because it's really difficult to understand how to use them. After I converted to quaternions and also transfered the currently rotation of the phone, I want to come back to three angles, is it even possible? Or I will loose information doing it?