- Home /
 
Swipe menu, problem!
Hi,there! I have a problem with this script. The script will be a simple swipe menu for 2d car game. The base for the movement has been created i just want it to have much smaller speed/movement becuase for now it's to fast for my needs. So it need something to limits it's speed like min/max value, and also something that would not let the object to trespass after a specific value on the x axis left and right side. So again a speed limiter with min/max value, and a left/right movement stopper after some value! I hope is everything clear, and thanks in advance for the answers!
Btw here is the script:
 #pragma strict
      
 function Update () {
 
     if (Input.touchCount>0 && Input.GetTouch(0).phase==TouchPhase.Moved) {
         var touchDelta : Vector2 = Input.GetTouch(0).deltaPosition;
         transform.Translate (touchDelta.x, 0, 0);
     }
 }
 
              Your answer
 
             Follow this Question
Related Questions
Touch Controls for mobile 1 Answer
Detect if finger lifted off screen 1 Answer
Swipe and Joystick Together on Mobile 0 Answers
Android: After the third touch all touches get cancelled 1 Answer