- Home /
how to make the object moves when I physically move the mob.
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,
Answer by KittenSnipes · Jan 20, 2018 at 11:14 PM
Well if you import the package 'CrossPlatformInput' you can go under the prefabs folder and find a bunch of different great controllers. Drag it on to your scene and it should work.
Your answer
![](https://koobas.hobune.stream/wayback/20220612150922im_/https://answers.unity.com/themes/thub/images/avi.jpg)