- Home /
 
               Question by 
               gss214 · Oct 12, 2015 at 08:33 PM · 
                touchtouch controlstouchscreenx-axis  
              
 
              move object x axis with finger touch
Hello, I have this code (below) well basic, which moves an object in the X axis but usually anywhere on the screen that I touch it continues moving this object. How to limit it to do that only when you touch the object, move it?
     if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
         Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
         transform.Translate (touchDeltaPosition.x * speed, 0 , 0 * Time.deltaTime);
         }
 
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Possible to get touch area data? 1 Answer
Working with screen's touch limit 0 Answers
Make object follow my finger (Touch)? 1 Answer
Shump Touch Control 1 Answer
Reset touch Vector after movement 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                