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?

Était-ce utile?

La 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 !

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top