但是如果我将播放器设置方向设置为自动方向,只有横向左侧和允许横向右侧,则会出现问题.当它处于横向左侧时,一切都按照正常情况工作,但是当它处于横向右侧时,纸板视图将转动180度(设置按钮移动到屏幕的底部)但是我的统一对象没有.因此,我有一个颠倒的对象.
有什么办法解决这个问题?
谢谢.
解决方法 看起来SDK用于读取陀螺仪的本机代码仅针对Landscape left方向进行了硬编码.这可以通过编辑BaseCardboardDevice.cs并使用以下代码替换UpdateState()的定义来解决:private Quaternion fixOrIEntation;public overrIDe voID UpdateState() { GetheadPose(headData,Time.smoothDeltaTime); ExtractMatrix(ref headVIEw,headData); headPose.SetRightHanded(headVIEw.inverse); // Fix head pose based on device orIEntation (since native code assumes Landscape left). switch (input.deviceOrIEntation) { case DeviceOrIEntation.Landscapeleft: fixOrIEntation = Quaternion.IDentity; return; case DeviceOrIEntation.LandscapeRight: fixOrIEntation = Quaternion.Euler(0,180); break; } headPose.Set(headPose.position,headPose.OrIEntation * fixOrIEntation);}
我建议在Cardboard设置中关闭Neck Model Scale(将其设置为0),因为它不会出现在此代码中.
总结以上是内存溢出为你收集整理的c# – Unity Cardboard Orientation Landscape Right Up全部内容,希望文章能够帮你解决c# – Unity Cardboard Orientation Landscape Right Up所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)