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?

有帮助吗?

解决方案

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 !

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top