Unity3d调用iOS陀螺仪

How to write gyroscope controller with Unity3d

http://blog.heyworks.com/how-to-write-gyroscope-controller-with-unity3d/

Unity3d调用iOS接口播放视频,在视频播放完之后回到Unity3d场景时会出现世界颠倒的问题。

解决的方法是修改上述链接中附件中GyroController的代码,修改方法GetRotFix(),去掉#UNITY_3_5标签:

    private Quaternion GetRotFix()
{
//#if UNITY_3_5
if (Screen.orientation == ScreenOrientation.Portrait)
return Quaternion.identity; if (Screen.orientation == ScreenOrientation.LandscapeLeft || Screen.orientation == ScreenOrientation.Landscape)
return landscapeLeft; if (Screen.orientation == ScreenOrientation.LandscapeRight)
return landscapeRight; if (Screen.orientation == ScreenOrientation.PortraitUpsideDown)
return upsideDown;
return Quaternion.identity;
//#else
// return Quaternion.identity;
//#endif
}

每帧进行判断,则可解决该问题。

上一篇:HDU 2167 状压dp方格取数


下一篇:ERDAS 2013与ArcGIS10.1安装时的兼容性问题