I would like in my scene to be able to use the double tap by touch to zooming (x2), on Ipad,
someone know how i can do this ?
thank you
I would like in my scene to be able to use the double tap by touch to zooming (x2), on Ipad,
someone know how i can do this ?
thank you
I have the same problem but I found fixed it.Double tap zooming is slightly tough than pinch zoom that developer don’t generally prefer it.
Input.touchCount is used to count touch on the screen and its increment the value with 1 as whenever the user taps on the screen. After getting two touches from the user, my ‘howmanytouch’ variable becomes two and now if statements gets executed for zooming
Now another strange thing u may notice is Invoke() function when user touch the screen first time I start interval time by calling Invoke(“functionName”, no.ofseconds), i.e if user don’t touch second time within in one second it will reset to zero
public static int howmanytouch;
public bool twotapcomplete = true;
void Update ()
{
if (twotapcomplete && (Input.touchCount == 1)) {
if (Input.GetTouch (0).phase == TouchPhase.Ended) {
++howmanytouch;
Invoke ("intervalbetweentouch", 1);
}
}
if (howmanytouch >= 2) {
CancelInvoke ("intervalbetweentouch");
twotapcomplete = false;
transform.localPosition = Vector3.MoveTowards (transform.position, new Vector3 (-2, 2, -5), 10 * Time.deltaTime);
}
if(Input.touchCount > 0)
Debug.Log(Input.GetTouch (0).position);
}
void intervalbetweentouch()
{
howmanytouch = 0;
}
apologize for any wrong buggy words as because I am not a native english speaker.
thanks for reading