Can I disable/cancel touch if not on object?

This might be a dumb question, but I wonder if it is possible to cancel the touch that is not on the object but on the background.

Here is the problem. In a childrens app it is really unfortunate to have the “single touch listener”. Some children hold the tablet in a way that many fingers touch the screen at the same time, making it impossible to touch/drag the object on the screen.

I´m hoping there would be a method easier than multitouch because frankly I dont need multitouch?! because there is a single object on the screen.

I hope I managed to explain my problem.

Thanx  :wink:

Before providing an answer, I would like to clarify your situation’s problem:

“Problem: When a child holds the tablet they may put many fingers on the screen at once. For single-touch mode this usually stops the intended display object from being dragged. Multi-touch would solve the problem but seems to be more complicated to implement.”

If that’s right I think I have a solution for you.

That is correct  :smiley:

In general, do not listen for touches on the Runtime object, because any touch which is not caught will cause it to register against the Runtime.

IMHO, the simplest solution is to enable multi-touch and only listen for touches on specific objects. If you really do want single-touch behaviour, you should set a variable to true once a “useful” touch has been registered against a malleable object. This will allow you to ignore excessive touches and handle the first sensible touch.

Let me know if you’d like a code sample and I’ll try to work one up.

In short, the logic would be:

Enable multi-touch

Create objects with their own touch listener

When a touch is detected:

*1 If no touch is registered yet, log it’s Touch ID with a central library

*2 If a touch is already registered with a central library, ignore the touch

Wow  :blink:  I´m impressed with the response time and the answer!

You would be my hero if you could give me a code sample :rolleyes:  

I´m not excactly a code ninja  :ph34r: and would spend the rest of the week trying to figure this out.

Thank you  :smiley:

I’ve not tried this on-device, so it may not work, but it should follow the general logic you want:

https://dl.dropboxusercontent.com/u/10254959/Help/MultiTouchIgnore/main.lua

All touches should be ignored except those made directly on one of the rotating circles. It’s dumb, but the general idea (if it were a game for kids) would be to arrange the circles so they don’t touch.

You’re on your own if the kids have jam on their fingers.

Hahaha  :smiley:

Thank you!!!  I´ll let you know how it worked as soon as I have tested this on the device,.

You are officially my hero  B)

Thanx a lot!

-Tom

WOW :lol: 

It works perfect on my device!

Thanx a lot for the code. It would have taken me ages to figure that one out  :frowning:

Ok hmmm :unsure:  your code works like a charm, but is there a way to use the code on a physics object. My physics objects (a bucket and an apple) wont get dragged around. I can lift the objects slightly before they fall down again.

I´m also wondering if it is possible to add a “touchjoint” on the physics object (when using your code).

Thanx a lot for your help  :smiley:

Hey, sorry for taking so long to respond - been working…

I’ll modify the code for physics, though if you search the forums for my username you should find plenty of the same code as I have posted this stuff before. The basic change is to attach a touch joint instead of modifying the .x,.y values directly.

And here’s the physics version:

https://dl.dropboxusercontent.com/u/10254959/Help/MultiTouchIgnorePhys/main.lua

Note: Normally, I would place a static anchor object off-screen and make the walls dynamic, welded (“weld” joint) to the anchor, to keep them in place. This is a better solution for holding objects in a fixed position.

It works!

Don´t be sorry for 3 hour response time…thats great :D  I´m sorry for bothering you with stuff you allready have posted  :frowning:

I will search the forums for your username in the future.

I´ve been trying to solve this myself, but I keep ending up banging my head against the wall  :mellow:

Thanx for helping me out…again  :rolleyes:

Before providing an answer, I would like to clarify your situation’s problem:

“Problem: When a child holds the tablet they may put many fingers on the screen at once. For single-touch mode this usually stops the intended display object from being dragged. Multi-touch would solve the problem but seems to be more complicated to implement.”

If that’s right I think I have a solution for you.

That is correct  :smiley:

In general, do not listen for touches on the Runtime object, because any touch which is not caught will cause it to register against the Runtime.

IMHO, the simplest solution is to enable multi-touch and only listen for touches on specific objects. If you really do want single-touch behaviour, you should set a variable to true once a “useful” touch has been registered against a malleable object. This will allow you to ignore excessive touches and handle the first sensible touch.

Let me know if you’d like a code sample and I’ll try to work one up.

In short, the logic would be:

Enable multi-touch

Create objects with their own touch listener

When a touch is detected:

*1 If no touch is registered yet, log it’s Touch ID with a central library

*2 If a touch is already registered with a central library, ignore the touch

Wow  :blink:  I´m impressed with the response time and the answer!

You would be my hero if you could give me a code sample :rolleyes:  

I´m not excactly a code ninja  :ph34r: and would spend the rest of the week trying to figure this out.

Thank you  :smiley:

I’ve not tried this on-device, so it may not work, but it should follow the general logic you want:

https://dl.dropboxusercontent.com/u/10254959/Help/MultiTouchIgnore/main.lua

All touches should be ignored except those made directly on one of the rotating circles. It’s dumb, but the general idea (if it were a game for kids) would be to arrange the circles so they don’t touch.

You’re on your own if the kids have jam on their fingers.

Hahaha  :smiley:

Thank you!!!  I´ll let you know how it worked as soon as I have tested this on the device,.

You are officially my hero  B)

Thanx a lot!

-Tom

WOW :lol: 

It works perfect on my device!

Thanx a lot for the code. It would have taken me ages to figure that one out  :frowning:

Ok hmmm :unsure:  your code works like a charm, but is there a way to use the code on a physics object. My physics objects (a bucket and an apple) wont get dragged around. I can lift the objects slightly before they fall down again.

I´m also wondering if it is possible to add a “touchjoint” on the physics object (when using your code).

Thanx a lot for your help  :smiley: