Guest User

Untitled

a guest
Nov 18th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. void Update()
  2. {
  3. if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
  4. {
  5. // Control sliding using touch input.
  6. Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
  7. transform.Translate(touchDeltaPosition.x * slidingSpeed, 0, 0);
  8. }
  9. transform.position = new Vector3 (Mathf.Clamp(transform.position.x, - xPosLimit, xPosLimit), transform.position.y, transform.position.z);
  10. }
Add Comment
Please, Sign In to add comment