Hi,
please guide me how to detect the finger drag direction ( up and down).
Advance thanks
Hi,
please guide me how to detect the finger drag direction ( up and down).
Advance thanks
if (Input.touchCount == 1) {
Touch t = Input.touches[0];
if(t.phase == TouchPhase.Began) {
startvec = t.position;//initialise touchdown vector
ismoving = true;
}
else if(t.phase == TouchPhase.Ended) {
ismoving = false;
}
if(ismoving){
Vector2 v = t.position-startvec;// subtract startvec from current finger position
if(v.y < 0) Debug.Log("down");
if(v.y > 0) Debug.Log("up");
Move(v.y*0.1f);
Turn(v.x*0.01f);
}
}
Thanks,its working. thanks again.