So I want to make a mobile app where the angle of the camera moves with the angle of the screen, so that the screen is always facing up (As in up in real life). Is their any way to do this? Any help would be much appreciated. By the way, I am talking about 2d, not 3d.
Y-Hello there,
to check physical device orientation you have to access its sensors like Gyroscope and Accelerometer. With those you can know exactly what is the orientation of the device and if the user is rotating it, or moving it (like shaking for example).
Here you can find some references:
https://docs.unity3d.com/ScriptReference/Gyroscope.html
Thanks! But I don’t really know how to use it. I would only need part of it, and the 2d camera needs to move with the clockwise/counter-clockwise movement of the phone. Do you have any idea how to do that? Any help would be much appreciated!
Hey @Crazybrownie204 ,
I cannot write the code for you, but on YouTube you can find a lot of tutorials on how to make the camera moves with the phone rotation.
Here’s a little example, but there are literally tons of resources where to get this information, being a developer means also being able to research properly a subject.
Using your phone’s Gyroscope [Tutorial][C#] - Unity tutorial 2019