Best Gyroscope plugin

What is the best gyroscope plugin to control the rotation of the Unity camera on iOS and Android?
It should run as smoothly as possible, maybe by using additional sensors like compass, accelerometer.

I read about some problems using Input.gyro on android devices, so I do not know if I should use Input.gyro. It might also be not good enough because it uses only the gyroscope sensor.

I also want full control over the image of the camera.
I can not use Unitys Virtual Reality support because it always renders with two cameras in split screen, but I also want to be able to switch to a single camera.

I found a possible solution using Unity Virtual Reality support:
-Magic Window mode-
camTrans.localRotation = XRInput.GetLocalRotation(XRNode.CenterEye);

I’m at the same point in my project. Found that the gyro calculations using the XRNode.Head works quite well. With it comes the stereoscopic, two-camera overlay on my screen. Any idea to remove this, while keep using gyro calculations from InputTracking.GetLocalRotation(XRNode.Head) ?

By following these steps: Switching between VR and non VR at runtime Ā· googlevr/gvr-unity-sdk Wiki Ā· GitHub you can configure to switch on/off VR modes at runtime.

If you add ā€˜none’ to the possible VR SDKs on Player Settings in the first place, you get the normal behaviour of 1 camera, BUT, if you establish the VR SDK device through the line:

XRSettings.LoadDeviceByName(ā€œcardboardā€);

You get HeadTracking with 1 camera or magic window mode (https://docs.unity3d.com/Manual/VRDevices-GoogleVR.html)

Awesome! I figured it out myself as well, and this is all great. So now I have the following:

In Player Settings → XR Settings:

  • Virtual Reality Supported Enabled
  • In SDKs: None, Cardboard

In void Start():

  • XRSettings.enabled = false;
  • XRSettings.LoadDeviceByName(ā€œcardboardā€);

In void Update():

  • camRigTransform.rotation = InputTracking.GetLocalRotation(XRNode.CenterEye);

Now the next issue is to force orientation to portrait, as our apps usually run in portrait mode whilst needing great gyro data… Afaik enabling VR Support locks the Landscape Left orientation in Player Settings…

1 Like

Cardboard SDK 0.6 will allow toggling VR mode on and off, and allow for orientation changes:

Thank you, the Cardboard SDK 0.6 works for Unity 5.6.0f3, but not for Unity 2017, which is what I need. Any ideas?

1 Like