- Home /
 
How do I Restrict movement for an Object Unity Mobile
Hello. I am designing a mobile game that has the object move left and right on the x axis with the accelerometer. How would I be able to restrict movement to this object? Thank you.
 using UnityEngine;
 using System.Collections;
 
 public class carController : MonoBehaviour {
     Vector3 position;
 
 
 
     void Start()     {
 
     }
 
     void Update () 
     {
         
 
 
         transform.Translate (Input.acceleration.x,0, -Input.acceleration.x);
 
         
     }
 }
 
              
               Comment
              
 
               
              Your answer