Hello,
I’m trying to make a new game for android and I need the character to move left and right when you move your phone left and right. I konw that there is a script called “AccelerometerInput” which is in the unity tutorials (I think). The problem is that it also moves the character in the z axis but I only want it to move in the x axis (left and right).
This is the script:
using UnityEngine;
using System.Collections;
public class AccelerometerInput : MonoBehaviour
{
void Update ()
{
transform.Translate(Input.acceleration.x, 0, Input.acceleration.y);
}
}
I would like to know if there is a script that works well or there is a way to change this script to make it the way I want it. I’m pretty sure this is a stupid question but I’m new on scripting.
Thanks in Advance.