Gyroscope rotation offset

190557-screenshot-77.pngHi! I’m making a game using the gyroscope (2d game). When I rotate my phone, it rotates the player’s character.
However, when my phone is totally straight (landscape), my character isn’t straight. (see screenshot) I tried to see and there’s like an offset of 70° (when my phone is at 90°, my character is at 160°)

Here is my script:

    void Update()
    {
    	transform.rotation = GyroToUnity(Input.gyro.attitude)
    }
    
    Quaternion GyroToUnity(Quaternion q)
    {
    	return new Quaternion(0f, 0f, -q.z, -q.w);
    }

If I return a new Quaternion, it’s just because I only want the Z rotation (because it’s a 2d game).

I tried to do a simple addition like -q.z - 70 but then it does something weird and only moves between 179° and 180°.
If anyone has the answer ^^

Thanks in advance!

Hey again ! I found a solution to my problem.
You can just put the object you want to rotate (in my case, the player) in another gameobject that is like rotated of 90° (if you want to rotate of 90°), and then rotate your object using the localRotation.