Hi I have a Unity app which uses google Cardboard SDK to enable stereoscopic view so I will have a VR enabled app. My app runs perfectly fine.
But there is a problem if I set the player settings orientation to be auto orientation with only landscape left and landscape right allowed. When it is in landscape left, everything works as per normal but when it is in landscape right the cardboard view will turn 180 degrees (settings button moved to bottom of screen) but my unity objects does not. Thus I have an upside-down objects.
Any method to fix this?
Thanks.
You can just add:
at the and of UpdateState() of BaseCardboardDevice class. It fixed this problem for me regardless of how I turned the devices I tried it on. Unity 5 cardboard SDK v0.5.1
Now, Cardboard SDK became GoogleVR, so I wrote like this at GvrDevice.cs
I’ve solved this issue, here’s the solution (valid for Cardboard v0.5.2)
First, as suggested by smd, you need to apply orientation adjust in BaseCardboardDevice / UpdateState(). However, you should check ScreenOrientation rather than DeviceOrientation. Code is as follows:
This will fix the orientation, but that’s not enough, because you will be facing wrong direction after Cardboard Recenter(). To workaround this, you also need to apply the rotation in CardboardHead / UpdateHead() method, the code is like this:
It appears the native code that the SDK uses to read the gyro is hardcoded for Landscape Left orientation only. This can be worked around by editing BaseCardboardDevice.cs and replacing the definition of UpdateState() with the following code:
I suggest turning off the Neck Model Scale (set it to 0) in the Cardboard settings too, since it won't come out right with this code.
One way to let your app appear in both LandscapeLeft and LandscapeRight, without getting fixed to only one, is in the Start method to enable the screen settings in this sequence:
Basically you force one side, then enable automatic rotation, and then prevent the rotation from being Portrait.
-