在Unity3D 4.6.7中跨场景加载坚持Google Cardboard的前进方向吗? [英] Persist Google Cardboard forward direction across scene loads in Unity3D 4.6.7?

查看:107
本文介绍了在Unity3D 4.6.7中跨场景加载坚持Google Cardboard的前进方向吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在加载场景后,尝试维护Google Cardboard对于该设备的要求时遇到了麻烦.尽管我在SDK c#代码中找不到对此的任何明显调用,但看来Google Cardboard SDK会在每次加载场景后自动调用最近者".我尝试在实例化的硬纸板预制件和Cardboard.SDK对象(在Cardboard.cs的第328行中提到)上调用DontDestroyOnLoad.这样可以在负载中持久保留这些对象,但是视图仍会根据设备的当前方向重新居中.

I'm having trouble trying to maintain what Google Cardboard considers forward for the device after a scene load. Although I can't find any obvious call to this in the SDK c# code, it appears that the Google Cardboard SDK will automatically call Recenter after each scene load. I've tried calling DontDestroyOnLoad on the cardboard instantiated prefab, and on the Cardboard.SDK object (which is mentioned on line 328 of Cardboard.cs). This persists those objects across the load, but the view is still re-centered based on the current orientation of the device.

我想避免使用更新程序,因为一些可以启动加载的基于凝视的菜单项位于用户的左侧或右侧,这会使场景加载后新的中心位于左侧/右侧.然后,用户必须身体移动以面对新的前进方向.

I want to avoid the recenter because some of the gaze-based menu items that can initiate a load are off to the user's left or right - which then makes the new center be to the left/right after the scene load. The user then has to physically move their body to be facing towards the new forward.

还有其他人在尝试相同的事情吗?我缺少明显的东西吗?

Is anyone else attempting the same thing? Am I missing something obvious?

非常感谢任何建议!

推荐答案

函数Cardboard.OnLevelWasLoaded()调用device.Reset(),在基类实现中,该函数仅调用Latester(),您所看到的效果.如果您注释掉该行,或者使用您可以控制的变量对其进行保护,则饰面不应重设.

The function Cardboard.OnLevelWasLoaded() calls device.Reset(), which in the base class implementation just calls Recenter(), which has the effect you are seeing. If you comment out that line, or guard it with a variable you can control, the facing should not reset.

这篇关于在Unity3D 4.6.7中跨场景加载坚持Google Cardboard的前进方向吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆