How to restrict Y-axis value?
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { touchDeltaPosition = Input.GetTouch(0).deltaPosition;
float newPosition=Mathf.Repeat (Time.time*speed,x); transform.Translate(0, +touchDeltaPosition.y * speed, 0); }
This my code to move a quad up and down assigning "touchDeltaPosition.y" to Y-axis.The problem is that the quad moves even beyond my view. How to restrict the y axis of the quad?
Comment