Auto-rotate screen on android

252951-снимок.jpg

pin x (separated gravity contact) gives values ​​from “-10” to “10”.
Positive values ​​are standard land-scape mode, negative values ​​are when the phone is rotated.
Then it’s easy to separate when there is a turn for the camera and widgets.
Personally, I plan to update the function every half second and write it to the game instance, and then use it either as a spawn or to call the functions to change the orientation in the widgets and charakter, I think this is a good choice.