Question

I'm wanting to have singular objects within my game in Unity rotate based on the screen orientation of the screen. I've been playing about with Unity's in built Screen Orientation code but this moves the entire screen when I want only a single object in my screen to move.

Has anyone every achieved similar functionality without the need to create dedicated plug ins for either iOS or Android?

Was it helpful?

Solution

ScreenOrientation is based for the screen only. Most of the SmartPhone have a gyroscope, and Unity can use it.

Doc Unity : Gyroscope Rotation

You can then use rotation of the gyroscope.

Enjoy !

OTHER TIPS

You can use accelerometer readings of the device. Input.acceleration provides value of acceleration between 0 to 1 in all Axis i.e X,Y and Z. you can use it . I have used it in my application and it worked great.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top