Hello. I am trying to make a 2d Car game where you tilt the car left and right to avoid obstacles. I am trying to be able to tilt it only on the x axis. Any time I tilt the device the car moves on the z axis and the y axis. Please help friends.:
using UnityEngine;
using System.Collections;
public class carController : MonoBehaviour {
public float CarSpeed;
public float maxPos = 2.2f;
void Update ()
{
transform.Translate (Input.acceleration.x, 0, +Input.acceleration.x);
}
}