Persist Google Cardboard forward direction across

2019-02-18 14:45发布

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?

Any suggestions very much appreciated!

2条回答
该账号已被封号
2楼-- · 2019-02-18 15:28

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.

查看更多
干净又极端
3楼-- · 2019-02-18 15:34

I had the same problem but on Gear VR (Unity 5). In case anyone else is looking for this, I've answered it here.

Briefly, if you're also using OVR Utilities from Oculus:

  1. Locate the OVR Manager script attached to the OVRCameraRig
  2. Uncheck 'Reset Tracker On Load'
查看更多
登录 后发表回答