Detecting multitouch

Does anyone have a method for detecting a multitouch event?  I use event.numTaps to monitor and control user tap interactions.  With multitouch events I’m looking for a similar level of control with an “event.numTouch” method so I can use multitouch to bypass the top layers of display objects and interact with the bottom layer.

for example:

if (multitouch) then

     “scale bottom layer”

end

Any suggestions?

Thanks,

Jonathan

     

  1. use touch listeners not tap listeners

  2. activate/enable multitouch https://docs.coronalabs.com/daily/api/library/system/activate.html#example

  3. You’re not confusing ‘multitouch’ with double tap are you?

I’m unclear on this ‘bypassing layers’ idea.  If you touch an object it will always receive touches before the objects below it at that same touch position.  Multi touch won’t affect this.

Can you elaborate more on what you’re trying to achieve?

To be clear: Multi-touch is the ability to detect and handle multiple simultaneous touches at the same time and to ensure that one touch handler receives all of the ‘touches’ for a particular finger even if multiple fingers are on the screen at the same time.  Its about allowing simultaneous touches and logical routing of events.

One handler per ‘finger’ and that handler gets the start, moved, ended, etc. for that finger and that finger only

Hey Roaming Gamer,

Thanks for you prompt reply and I apologize for my delay.  The effect I’m trying to achieve is having a one-finger touch automatically interact with characters in the foreground and a multi-finger touch automatically interact with the background (pinch and reverse pinch for scaling, rotating and moving the world).

In other words:

one touch —> character

multiple touches —> background and scaling

Currently, my app requires clicking on the “zoom” icon to enact the pinch-scaling and clicking on the “character” icon to interact with the characters.  My play testers (and I) have found that clicking back and forth between character and zoom modes detracts from game play.

I was hoping there might be a native method for detecting multiple simultaneous touches.  Your explanation of multi-touch being the independent tracking of multiple single touches exposes an errant assumption I made about the difference between single and multi-touch being different events.  I see now that multi-touch isn’t an independent event but a collection of single-touches each tracked independently; “one handler per finger” as you said.

Here’s what I’m going to try:

Each time a touch event is registered I’m going to track it independently but keep a total count of simultaneous touches.  If total count > 1, then I will pass each touch individually to the touch handler of my scaling module.  If total count == 1, then that touch will interact with characters in the foreground (assuming the touch is on a character).

I think it will work!  I’ll let you know how it goes, thanks again!

Jonathan

  1. use touch listeners not tap listeners

  2. activate/enable multitouch https://docs.coronalabs.com/daily/api/library/system/activate.html#example

  3. You’re not confusing ‘multitouch’ with double tap are you?

I’m unclear on this ‘bypassing layers’ idea.  If you touch an object it will always receive touches before the objects below it at that same touch position.  Multi touch won’t affect this.

Can you elaborate more on what you’re trying to achieve?

To be clear: Multi-touch is the ability to detect and handle multiple simultaneous touches at the same time and to ensure that one touch handler receives all of the ‘touches’ for a particular finger even if multiple fingers are on the screen at the same time.  Its about allowing simultaneous touches and logical routing of events.

One handler per ‘finger’ and that handler gets the start, moved, ended, etc. for that finger and that finger only

Hey Roaming Gamer,

Thanks for you prompt reply and I apologize for my delay.  The effect I’m trying to achieve is having a one-finger touch automatically interact with characters in the foreground and a multi-finger touch automatically interact with the background (pinch and reverse pinch for scaling, rotating and moving the world).

In other words:

one touch —> character

multiple touches —> background and scaling

Currently, my app requires clicking on the “zoom” icon to enact the pinch-scaling and clicking on the “character” icon to interact with the characters.  My play testers (and I) have found that clicking back and forth between character and zoom modes detracts from game play.

I was hoping there might be a native method for detecting multiple simultaneous touches.  Your explanation of multi-touch being the independent tracking of multiple single touches exposes an errant assumption I made about the difference between single and multi-touch being different events.  I see now that multi-touch isn’t an independent event but a collection of single-touches each tracked independently; “one handler per finger” as you said.

Here’s what I’m going to try:

Each time a touch event is registered I’m going to track it independently but keep a total count of simultaneous touches.  If total count > 1, then I will pass each touch individually to the touch handler of my scaling module.  If total count == 1, then that touch will interact with characters in the foreground (assuming the touch is on a character).

I think it will work!  I’ll let you know how it goes, thanks again!

Jonathan