Passing touch event through object

Hey guys,

Usually with touch events on an object, you want to make sure that the touch doesn’t leak through the object to other objects below.  However, I am trying get a touch event to leak through, but I can’t seem to get it to work.

I have draggable circles that I want the user to drag and drop on a specific area of the screen.  I have an image for this area and have applied a bitmap mask to it so that its touch region is pixel perfect.

What I am trying to solve is this:  How can I detect whether or not the user drops one of the circles on this specific region or not?  I was thinking that if I can get an “ended” event to pass through the circle object and to the specific region below, then I would know that they dropped the circle on top of that specific region.

Is there a better way to go about this? any ideas or thoughts?

Hi @rxmarccall,

You might consider using another method to sense if the circles have been “dropped” in the correct place. This guest tutorial and example shows one method which you can probably tweak to suit your needs:

http://www.coronalabs.com/blog/2013/01/29/basic-shape-matching-app/

Hope this helps,

Brent

Thanks for the link Brent, its helpful but not quite what I’m looking for.  Not trying to snap anything into place.  Just have a strangely shaped background object and want to find out if a circle object is on top of if when the user lets go.

Hmmm, in that case, maybe you could allow touch responses to leak through the circle, but ignore (via condition) everything except the “ended” one, and then check if it resides on the other odd-shaped object?

Sounds like you need some non-physics collision detection.

See:  http://omnigeek.robmiracle.com/2011/12/14/collision-detection-without-physics/

In particular the circle detection   You can do the look up in your drag code.

Thanks for the tips guys, Ill check that link out for sure.  For now I took the easy way out by just checking a TON of x,y values to see if it was dropped in the right place on the screen.

Hi @rxmarccall,

You might consider using another method to sense if the circles have been “dropped” in the correct place. This guest tutorial and example shows one method which you can probably tweak to suit your needs:

http://www.coronalabs.com/blog/2013/01/29/basic-shape-matching-app/

Hope this helps,

Brent

Thanks for the link Brent, its helpful but not quite what I’m looking for.  Not trying to snap anything into place.  Just have a strangely shaped background object and want to find out if a circle object is on top of if when the user lets go.

Hmmm, in that case, maybe you could allow touch responses to leak through the circle, but ignore (via condition) everything except the “ended” one, and then check if it resides on the other odd-shaped object?

Sounds like you need some non-physics collision detection.

See:  http://omnigeek.robmiracle.com/2011/12/14/collision-detection-without-physics/

In particular the circle detection   You can do the look up in your drag code.

Thanks for the tips guys, Ill check that link out for sure.  For now I took the easy way out by just checking a TON of x,y values to see if it was dropped in the right place on the screen.