Gyro Y axis problem help Y axis/angle is wrong

Hello everyone i need help in gyro…
Firstly im using mobile device Portrait mode…
1
Debug.Log(gyro.attitude.y);

This code gives me Y axis/angle but its wrong.
When i turn my phone to up down or left right Y is changing…
It must be only change Y when i turn my phone left right…
Why up down is affect Y angle ?

using System;
using UnityEngine;

public class Gyro : MonoBehaviour
{
    public float moveSpeed = 80f;

    private Rigidbody rb;

    // Use this for initialization
    void Start()
    {
        rb = gameObject.GetComponent<Rigidbody>();
    }

    public void Update()
    {
        Vector3 movement = new Vector3(Input.acceleration.x, 0f, Input.acceleration.y);
        rb.AddForce(movement * moveSpeed);
    }
}

This is what I use for Gyro. It works, not perfect but it works (Landscape mode). You may be able to use this for portrait?

Sorry but its not gyro … its acceleration :smile:
This is the gyro link ; https://docs.unity3d.com/ScriptReference/Gyroscope.html
Thanks for reply btw :slight_smile: