I want to make an android game about an object in the middle of the screen. It is supposed to work this way: I hold the phone vertically, and the object moves based on the phone’s movement either up or down.
I made some searching about the accelerometer and tried this code :
float temp = Input.acceleration.y;
transform.Translate(0, temp, 0);
But the code I have works only when I put the phone horizontally and in a quite different way: the object moves up or down by leaning the phone a little on the horizontal axis.
Any suggestions?
Thanks in advance,