So lately I’ve been messing around with the Accelerometer code in the tutorials for Unity, and I was wondering how can I get my game object to move up and down on the Y axis instead of the X? You see I use this little piece of code so far:
void Update() {
transform.Translate(Input.acceleration.x, 0, -Input.acceleration.z);
}
}
So this moves my game object right and left when I tilt the device right or left. Which is amazing but I’m trying to move it up or down when I tilt up or down. Changing the first Input.acceleration from x to y only changes the controls, but doesn’t change the movement of the game object. I know this is a very basic question, so scold me if you must. Also don’t worry I’ve checked other answers and they seem to use a different method than the one in the tutorial(the one I’m using), so it makes it harder to understand fully without copying someone else’s code.