hi everybody, i have some trouble with properly identifying touches on tablet.
basically i need to have just one tap, tap hold and rotate (or slide) and slide with two fingers…
the code i have works fine for slide with two fingers. it works when i want to rotate camera
but when i lift the finger if object is below the finger it will get selected. i want to avoid this
here is the code:
//IF WE HAVE TWO TOUCHES AND WE HAVE MOVEMENT OF BOTH OF THEM
if(Input.touchCount>1 Input.GetTouch(0).phase == TouchPhase.Moved Input.GetTouch(1).phase == TouchPhase.Moved){
distance += Input.GetTouch(0).deltaPosition.y*0.01;
//IF WE HAVE ONE TOUCH AND WE HAVE MOVEMENT
}
if(Input.touchCount == 1 Input.GetTouch(0).phase == TouchPhase.Moved) {
touchDeltaPosition = Input.GetTouch(0).deltaPosition;
x += touchDeltaPosition.x * xSpeed*0.003;
y -= touchDeltaPosition.y * ySpeed*0.003;
}
//IF WE HAVE JUST ONE CLICK
if(Input.touchCount == 1 Input.GetTouch(0).phase == TouchPhase.Ended){
var hit : RaycastHit;
//CHECK IF WE HIT SOMETHING WITH RAY FROM THE TOUCH POSITION TO INFINITY
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.GetTouch(0).position),hit,100)){
//DO SOMETHING
}
}
any ides appreciated!