x


ios pinch/tap/swipe/pan/(...) gesture

Is there a way, or script that can help distinguish finger gesture on iOS

For exemple, how to make the diffrence between a simple tap, a swipe, a pinch... ?

a kind of equivalent to the "UIGestureRecognizer class" for Ios (http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/cl/UIGestureRecognizer)

more ▼

asked Apr 08, 2011 at 01:26 PM

avatar image

RaphDuBus
77 3 4 6

Hopefully the asset store will soon see some tools to do this :)

Apr 08, 2011 at 02:09 PM Jean Fabre
(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first
more ▼

answered Apr 08, 2011 at 01:27 PM

avatar image

Justin Warner
6.8k 45 53 108

Thanks justin for answering.

I have ask this question because i have already google it, and search in forums... with no sucess. I had also already seen the link you give, but it does not answer my concerns.

Apr 08, 2011 at 01:38 PM RaphDuBus

Well, if you read it, it says you do have to code it yourself, and I don't think it's been done, as many people using Unity, use it to make game... Not so much apps... But maybe someone can help you further.

Apr 08, 2011 at 01:42 PM Justin Warner
(comments are locked)
10|3000 characters needed characters left

I use the following code. It works but i guess there are better ways to do it.

 float pinchLength = 0f;
 void Update(){
   if(Input.touchCount == 2 && Input.GetTouch(1).phase == TouchPhase.Began){
     pinchLength = Vector2.Distance(Input.GetTouch(0).position, Input.GetTouch(1).position);
   }
   if(Input.touchCount == 2 && (Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(1).phase == TouchPhase.Moved)){
     float deltaLength = Vector2.Distance(Input.GetTouch(0).position, Input.GetTouch(1).position);
     Game.cameraManager.ZoomBy(Mathf.Clamp(1f/pinchLength*(deltaLength),-1.5f,1.5f)); // ZoomBy(float Zoomfactor between -1.5x and +1.5x), eg orthographicSize
     pinchLength = Vector2.Distance(Input.GetTouch(0).position, Input.GetTouch(1).position);
   }
 }
more ▼

answered May 11, 2012 at 12:26 PM

avatar image

hedgie
15

(comments are locked)
10|3000 characters needed characters left

There's a swipe utility in the Asset Store. I've not tried it myself yet, but it's nicely priced.

more ▼

answered Apr 08, 2011 at 04:05 PM

avatar image

DaveA
34.5k 420 357 558

(comments are locked)
10|3000 characters needed characters left

You might be interested in checking out the FingerGestures scripting package from the Asset store. This is pretty much what you're after. You can get more information in the forum thread at http://forum.unity3d.com/threads/95983-FingerGestures-Robust-input-gestures-at-your-fingertips!

more ▼

answered Jul 09, 2011 at 12:21 AM

avatar image

Spk
49 4 3 7

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3536
x2297
x1889
x26

asked: Apr 08, 2011 at 01:26 PM

Seen: 14511 times

Last Updated: May 11, 2012 at 12:26 PM