Input.gyro issues on Android 7

I just submitted this as a bug, but I figured I should probably cross-post this here to see if anyone is hitting the same issues:

After updating my Samsung S6 to Android 7.0, my projects that relied on Input.gyro stopped working properly. The readings from Input.gyro.attitude and Input.gyro.userAcceleration appear to be lagging way behind the device’s current angular position and acceleration. The readings from rotationRate and rotationRateUnbiased appear to be unaffected by this bug. Adjusting the updateInterval doesn’t appear to help. (The gryoscope camera in Google Carboard’s SDK is unaffected by this bug, presumably since it does not rely on Unity’s Input.gryo.)

For example, the script below should simply be taking the attitude from the gryo and using that as an object’s rotation. If I throw this on a cube in a simple scene, the cube’s rotation lags way, way behind the device’s angular position. (See attached gif.)

Any advice on debugging this? (I’m on Windows 10 & Unity 5.6.1f1.)

public class GyroRotate : MonoBehaviour {
    void Start () {
        Input.gyro.enabled = true;
    }
    void Update () {
        transform.rotation = Input.gyro.attitude;
    }

    void OnGUI () {
        GUIStyle style = new GUIStyle();
        style.fontSize = Mathf.RoundToInt(Mathf.Min(Screen.width, Screen.height) / 20f);
        style.normal.textColor = Color.white;
        GUILayout.BeginVertical("box");
        GUILayout.Label("Attitude: " + Input.gyro.attitude.eulerAngles, style);
        GUILayout.Label("Rotation Rate: " + Input.gyro.rotationRate, style);
        GUILayout.Label("Rotation Rate Unbiased: " + Input.gyro.rotationRateUnbiased, style);
        GUILayout.Label("Acceleration: " + Input.gyro.userAcceleration, style);
        GUILayout.Label("Gravity: " + Input.gyro.gravity, style);
        GUILayout.EndVertical();
    }
}

3076693--231499--bug.gif

what is your bugreport number?

Hey @Mantas-Puida - it’s 912848

Thanks, I passed it to QA.

1 Like

Much appreciated!

I have just just discovered really laggy gyro on S6 (like low fps and poor quality tracking) which I am sure did not used to be the case - what is the status of this issue please, still awaiting a fix?

BTW on S7 it is good.

On S6 using the Google VR (GVR) asset it tracks the orientation perfectly using its native solution so will try and use that.

S6 is SM-G920F, guessing this and the edge version of it are the ones affected

As far as I know, the bug is still open (according to the issue tracker). I’ve been watching the patch releases, but I haven’t seen any release notes that address it. Using the Google VR native solution is the way to go.

1 Like

This might be a long shot, but did you tried with “Input.compensateSensors = true;”?

The Google VR native code returns far more accurate results than Unity’s on an S7 too, so either unity is doing it wrong or it is smoothing the input resulting in lag (default gyro settings left on as any change tried did not change result)
It does not help in setting up the gyro that none of the default values are mentioned for Input-gyro settings

1 Like

Thanks for the suggestion - but no dice on that fixing it.

Good to know, but a bit of a bummer. Shot in the dark guess - Unity may be smoothing over time and/or integrating the gyro sensor results with other sensors.

Just hit this exact same problem just now so it’s still there and not fixed in 5.6.1f1

1 Like

Hey, I have the same issue as you mentioned. You suggest using google-vr as for the gyro data. How can I do that without seeing the google cardboard display?

Just tested on Unity 2017.1.0f3 - still borked.

We are aware of this. It’s really a weird bug - we’re just getting the updates from the native sensors with delay :frowning:

4 Likes

Hi there,
Any luck i have also submitted my problem here

I have also very leggy movement of gyroscope in
Mobile: Samsung Galaxy S6
OS: Andriod 7.0
Unity: 5.2.1

Please let me know when will you resolve this issue.?

Its

Its 16 Aug 2017, one after your last comment. Any luck?

1 Like

Yes its an issue i am also facing it. Thanks for posting.

Any news about this issue?

Still broken as far as I can tell. This makes Unity pretty unusable for any of my Android devices, despite 3D party libs like Google Cardboard working fine.

Can any one provide an package to fix this problem in android consult by Google VR SDK