Android accelerometer - Input.acceleration linked to Input.deviceOrientation?

Hi everyone.

I’m currently working on an android app, and I’m experiencing some accelerometer related issues.

The game is landscape. I’ve attached this on a camera script

public ScreenOrientation prevScreen = ScreenOrientation.Landscape;

void Update()
if ((Screen.orientation != ScreenOrientation.LandscapeLeft) &&
    (Screen.orientation != ScreenOrientation.LandscapeRight))
    Screen.orientation = prevScreen;

	if ((Input.deviceOrientation == DeviceOrientation.LandscapeLeft) && (Screen.orientation != ScreenOrientation.LandscapeLeft))
	    Screen.orientation = ScreenOrientation.LandscapeLeft;
else if ((Input.deviceOrientation == DeviceOrientation.LandscapeRight) && (Screen.orientation != ScreenOrientation.LandscapeRight))
	    Screen.orientation = ScreenOrientation.LandscapeRight;

prevScreen = Screen.orientation;

And my input is handled like this,

public static float GetHorizontalAxis()
	float xAxis = -Input.acceleration.y;

	xAxisCurrent = xAxis * xAxisModifier;
	xAxisCurrent = Mathf.Clamp(xAxisCurrent,-turnClamp,turnClamp);

	return xAxisCurrent;

This works fine on my droid, an htc wildfire s, and we are currently getting people to test on their devices externally.

We have receved but reports that the turning isnt working properly.

"it doesn’t seem to respond to the G-sensor. It instantly swerves to the left and so the vehicle just goes off the edge of the course. I find that if I tip the tablet completely upside down then it starts to move back to the right, but as soon as I turn it upright, it just goes completely left again.

I’m holding the tablet in landscape mode (i.e. the same as in that main photo on the website), which is how the game starts."

The device hardware is fine, so its not a hardware error.
here is a link to the device

I can’t replicate the bug here, My best guess is that the os reported screen orientation might be the problem if the Input.acceleration is influenced by that.

The controls work by holding the device in a landscape mode, then tilting left and right to steer. They aren’t doing that in this case.

Thanks for your time.

Gravity results in acceleration, so the reported acceleration will always depend on the device’s orientation. One of the basic tenets of Relativity is that there is no difference between an accelerated reference frame and a reference frame in a gravitational field.