News: Enjoy our Christmas offer 30% off on our latest package Tower Defense Level Kit http://u3d.as/m7h

  • August 19, 2018, 07:40:54 PM

Login with username, password and session length

Author Topic: Single taps in quick succession are not treated as two taps  (Read 4265 times)

Offline sven

  • Newbie
  • *
  • Posts: 11
Single taps in quick succession are not treated as two taps
« on: April 03, 2016, 05:59:34 PM »
Hi,

I have a 2D button which can be tapped via Easy Touch and everything works fine. At least as long as the user doesn't use double taps. If the user quickly taps twice on the button it will only be interpreted as one tap instead of two.

The same happens in the asset's "One Finger" demo scene. When tapping on the "Tap me" sphere the tap is recognized, but two or three fast taps are interpreted only as a single tap instead of two or three. The gesture's touchCount property also only shows 1 instead of the correct number of taps. And there is a noticable delay between the tap and the callback.

So I would expect that my callback for single taps is immediately called after lifting the finger and also every time the finger is lifted. At least when the touch should not be cancelled by a recognized double or tripple tap, but for that I'm missing a flag to say so.

However, how can I get informed about each single tap even when quickly done in succession?

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Single taps in quick succession are not treated as two taps
« Reply #1 on: April 03, 2016, 07:50:26 PM »
Hi,

EasyTouch manage tap and double relative to Unity API, but you have to way to handle double tap in the inspector

   By system : Double works as EasyTouch 3.X   
   By time     : Double tap is relative to a maximum time, On_Simple isn't firing during a double tap, but a delay is required before to send it.

By default EasyTouc is set "by system", but in this case Unity API considers only 1 touch if the touch are to quickly.

For you need, I htink the best it's to use On_TouchStart & On_TouchUp, that allow to manage yourself each touch

Offline sven

  • Newbie
  • *
  • Posts: 11
Re: Single taps in quick succession are not treated as two taps
« Reply #2 on: April 05, 2016, 11:04:59 AM »
Thanks for your advice, but what can I do when the button has a "Easy Touch Object Proxy" script assigned to use it with a PlayMaker FSM?

As an example there is a simple button which toggles through different states by cycling through the selected language. When the user wants to skip the next 3 languages he taps the button 3 times rapidly, but only the first tap is used, so it feels buggy.

I would really appreciate a On_FastSimple or sort of that fires after each tap regardless of double taps and of course a corresponding event for PlayMaker.

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Single taps in quick succession are not treated as two taps
« Reply #3 on: April 09, 2016, 03:33:13 PM »
Hi,

Sorry for the delay.

Do you use Action or global event ?

Can you provide to me a test case ?

Offline sven

  • Newbie
  • *
  • Posts: 11
Re: Single taps in quick succession are not treated as two taps
« Reply #4 on: April 11, 2016, 11:07:25 AM »
Hi,

in my special case I'm using global events, but that's only me. Generally speaking it should also be possible to use actions or with code and not only with global events. The point is, that there should be a possibility to listen for simple taps which fires without delay. And of course it should co-exist with the already available On_SimpleTap event and the whole other system. So it's just an addition and thus a little feature request.

As test case you can take your Simple_Example test scene in the EasyTouchAddon4PlayMaker/_Examples folder of your asset. Just clone the "Sphere_Tap" object and make it change its color with each tap, regardless how fast the user taps on it. At the moment when tapping 2 or 3 times fast on it the color will only change once. With the new On_UndelayedSimpleTap event introduced the color should switch after each tap.

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Single taps in quick succession are not treated as two taps
« Reply #5 on: April 12, 2016, 09:34:00 AM »
Hi,

I think there may be a misunderstanding of the event to use, or how to setup EasyTouch. A tap event is fired when the finger is released and that his departure and end position are close (not when the touch begin), also a double tap is fired when there are two tap in very short period of time. So there is a slight delay to determine in which case we are. This reaction time is not configurable if you use the system for double detection parameter (managed by Unity). This means if you are too fast to tap Unity consider your gesture as double tap no as a simple tap.So you have a feeling to miss, because you get a double tap instead a tap for a frame.

So you have 2 solutions:
1- Use Touch_Start or Touch_Up instead Tap (if you try the example on the sphere "touch me", you don't have miss.

2- Set up EasyTouch like this:
By setting Easytouch to change yourself time required for detecting a double tap.But in this case, it will be very hard to do a double tap because the time is very short.




Offline sven

  • Newbie
  • *
  • Posts: 11
Re: Single taps in quick succession are not treated as two taps
« Reply #6 on: April 12, 2016, 02:14:51 PM »
Hi Nicolas,

thanks for the reply.

When using On_TouchUp in code I also get notified when the user moves off the object and then lifts the finger. That's fine, but a check for gesture.pickedObject == gameObject returns true even when the finger lifted was not anymore on this object. So how can I check if that's the case?

And how can I use this with PlayMaker? In a FSM I can listen for a global event called "ON_SIMPLETAP" on the object. That's easy to use and triggers my state every time (except when tapping too fast). There is also a local transition event for transitioning from one state to the next with the tap, but there is no local or global event "ON_TOUCHUP" or something like that which can be easily used with PlayMaker. So I'm missing the simple tap counterpart for touch down/up.

When looking at your example scene I can see that the touch sphere has 3 FSMs and each state has an action which blocks the execution until the action "Easy Touch Quick Touch" evaluates. For me this looks a little bit odd compared to the more streamlined simple tap events. While the quick touch action may be used to trigger a local action on a state, I don't see a possibility to use this as a global event. And the up action gets also fired when the user's finger is no more over the object, so same question as above, how can I check with TouchUp in PlayMaker whether the user really touched up on this object or if this happened outside?


Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Single taps in quick succession are not treated as two taps
« Reply #7 on: April 12, 2016, 03:53:14 PM »
Hi,

For me this looks a little bit odd compared to the more streamlined simple tap events
????

Have you try the solution N2 ?

it's working great

2- Set up EasyTouch like this:
By setting Easytouch to change yourself time required for detecting a double tap.But in this case, it will be very hard to do a double tap because the time is very short.

« Last Edit: April 12, 2016, 03:55:41 PM by Nicolas »

Offline sven

  • Newbie
  • *
  • Posts: 11
Re: Single taps in quick succession are not treated as two taps
« Reply #8 on: April 12, 2016, 04:42:12 PM »
Yes I tried both solutions, but solution No. 2 is not really one, rather a workaround, because as you said it will break all double taps in the scene. It's also not a good practice to change the detection time for double taps only to let single taps not swallow touches. And it doesn't solve the root problem: Being able to choose for each single object whether (A) to use single taps which cancels themselves when a double tap is detected or (B) to get informed about each single tap regardless of any further possibilities for double taps.

It's a nice solution tough, if there are no double taps in general, but in a usual case you just don't have double taps on a specific object, but on others. So solution No. 1 sounds more promising for me and any future projects. It's only the question now how to distinguish as easy as possible between lifting on an object and off an object. And how to do the same in conjunction with PlayMaker.

BTW in native iOS you have also a gesture recognition system, but there you can wire up different gestures logically together. So single taps fire immediately or you add them to a double tap gesture requiring it first to fail before the single tap can fire. With this the developer can choose which case to use for a specific object (A) or (B).

And with "For me this looks a little bit odd compared to the more streamlined simple tap events" I meant there is such a nice integration of Easy Touch in PlayMaker for simple taps, but not for the TouchX events. For simple taps I can easily add global and local transitions, just by right clicking on a state. For Touch events I have to rely on an action which blocks and then simulates a local transition. That's all.

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Single taps in quick succession are not treated as two taps
« Reply #9 on: April 12, 2016, 06:34:16 PM »
For simple taps I can easily add global and local transitions, just by right clicking on a state. For Touch events I have to rely on an action which blocks and then simulates a local transition. That's all.
You have 30 events available in EasyTouch, a simple touches is notified by the event On_TouchStart, On_TouchDown & On_TouchUP, so you have just to use them as you use On_SimpleTap.


For the first solution :
gesture.pickedObject => If equal to the gameobject under the touch when the touch start, this value is unchanged until Touch Up. So you have to compare this value with GetCurrentPicked Object.

Setup your fsm like this:







Offline sven

  • Newbie
  • *
  • Posts: 11
Re: Single taps in quick succession are not treated as two taps
« Reply #10 on: April 13, 2016, 04:01:06 PM »
Thanks a lot, the images helped. I could now set up the Touch Up event in conjunction with PlayMaker in my project. I just haven't looked in the right place. I always looked under "Add Global Transition" -> "Easy Touch" and missed to look into "Custom Events". Now I see the bunch of Easy Touch events you mentioned. So my apologies for confusing you, there is definitely a global Touch Up transition and everything works as streamlined as demanded.

Also the code solution now works perfectly when checking for (gesture.pickedObject == gameObject && EasyTouch.GetCurrentPickedObject(gesture.fingerIndex, false) == gameObject). Now everything works as expected.

Big Thanks for your support!

Offline itsallgoodgames

  • Newbie
  • *
  • Posts: 7
Re: Single taps in quick succession are not treated as two taps
« Reply #11 on: April 20, 2016, 11:54:24 PM »
hi,

My game doesn't use double tap so i tried using "Time" version with lowest value on slider but i'm not sure it's working right.

If i tap the screen the game treats it as 2 taps!

I tried moving the slider to maximum value of ".400" and now if i tap I get 2 taps .400 seconds apart lol!

Is this a bug?

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Single taps in quick succession are not treated as two taps
« Reply #12 on: April 21, 2016, 12:17:45 PM »
???

I need yo see more, show me your EasyTouch inspector, and the script that you use to test it

Offline itsallgoodgames

  • Newbie
  • *
  • Posts: 7
Re: Single taps in quick succession are not treated as two taps
« Reply #13 on: April 23, 2016, 11:11:44 AM »
Might be a bug with using QuickTap component and still manually creating an EasyTouch object to modify double tap detection property.

It's not critical issue for me, too lazy to fix lol... no worries.