Thats my code It works perfect in Unity while playing through Unity Remote on Galaxy Tab… When building an installing APK its just going FULL power left… Found out if i locked the Auto Rotation on the screen, and flips the screen it changes direction…
What am i doing wrong? Again works perfect playing in the Editor with Unity Remote on the tab…
acceleration is handled differently on android devices. Unity’s acceleration is based on the iOS accelerometer.
I’ve found for my android devices that i need a
var acc = Input.acceleration;
#if UNITY_ANDROID
var hold = acc.x;
acc.x = -acc.y;
acc.y = hold;
#endif
Last time I tried it, Unity Remote didn’t support the accelerometer or gyro.
What you’re seeing is probably gravity. The acceleration reading is generally aligned to the device’s default (portrait) orientation, regardless of what you tell Unity in the player settings. So if you’ve requested a landscape orientation, you need to shuffle the axes around. So the X axis points up or down (depending which landscape orientation you used), and the Y axis points left or right. You can for example multiply by Quaternion.Euler(0, 0, 90), or -90, to get Input.acceleration transformed into view space.
no problem. Be warned that i think this only works well if your not letting unity rotate your screens for you (IE: portrait, landscape left…). Or the results may seem a little unexpected.