I am trying to use Input.GetTouch(0).deltaPosition to move my main camera horizontally,
while the camera move to much than I expected.
What I expected is that if player start touch on the left most to the right most of the screen,
the camera will move according it screen width.
say my game is 405 x 720,
then the camera should move 405 on the x axis at most.
I have try to divide by some number by I still cannot get the effect I want.
public void checkSwipeStart(){
if (Input.touchCount>0 && Input.GetTouch(0).phase==TouchPhase.Moved) {
Vector2 touchDelta= Input.GetTouch(0).deltaPosition;
Camera.main.transform.Translate (-touchDelta.x/10, 0, 0);
//boundary
if(Camera.main.transform.localPosition.x<0){
Camera.main.transform.localPosition=new Vector3(0,0,0);
}
else if(Camera.main.transform.localPosition.x>(maxPage-1)*pagewidth){
Camera.main.transform.localPosition=new Vector3(maxPage*pagewidth,0,0);
}
}
}