Im making a mobile car game and im trying to implement tilt steering, when user tilts phone to left the car will steer left as long as he repositions phone (Im not looking for angular velocity). I use the z axis on attitude sensor, the problem Im facing now is when is if i spin in real life 180 degrees with out tilting the phone the Z axis changes, me spinning affects the steering for some reason.
private void Start()
{
InputSystem.EnableDevice(UnityEngine.InputSystem.Accelerometer.current);
InputSystem.EnableDevice(AttitudeSensor.current);
InputSystem.EnableDevice(Gyroscope.current);
}
private void DisplaySensorValues()
{
attitude.text = "" + AttitudeSensor.current.attitude.ReadValue().eulerAngles;
Gyro.text = "" + Gyroscope.current.angularVelocity.ReadValue();
Accelerometer.text = "" + UnityEngine.InputSystem.Accelerometer.current.acceleration.ReadValue();
}