Detect Gyroscope's rotation around a single axis? Like a car game.

Hey there!

I’ve been trying to detect the rotation of the device around the axis through the center of the screen. I want to roll/tilt the device and get the angle of rotation around that axis. I tried using Input.gyro.eulerAngles.z but it doesn’t seem to stay the same when I rotate the device around other axes. Imagine a car game with a steering wheel that uses the gyroscope to rotate. How can I implement this in Unity?

Here’s what worked for me.

private TextMeshProUGUI debugText;
private float paddleZRot;

void Update()
{
	Vector3 gyroEuler = Input.gyro.attitude.eulerAngles;
	phoneDummy.transform.eulerAngles = new Vector3(-1.0f * gyroEuler.x, -1.0f * gyroEuler.y, gyroEuler.z);
	debugText.text = "gyroEuler (" + gyroEuler.x + ",

" + gyroEuler.y + ",
" + gyroEuler.z + “)”;
Vector3 upVec = phoneDummy.transform.InverseTransformDirection(-1f * Vector3.forward);
paddleZRot = Mathf.Clamp((Map(upVec.x, -0.46f, 0.46f, -70, 70) * sensitivity), -70, 70);
}