Lost “Up” Events
Posted: 09 February 2009 09:57 AM   [ Ignore ]
Rank
Joined  2008-10-28
Total Posts:  21
New Member

Hi all,

We’ve been greatly enjoying using the touchlib AS3 libraries to develop some multi-touch stuff in our lab at Carleton University, including a sandwich-making game.

One issue we’ve been hitting and unable to figure out, is that we quite often lose the “up” events that should be triggered by a finger lifting off the table, often written as a “touchUp” event handler in the AS3 classes.

I’ve put a trace in the Rotatable class’s version of this event handler (it’s the one we’ve been using for our sandwich ingredients), and it definitely just doesn’t get called. Sometimes.

This is most notably true when the finger is *moving* when it lifts off the table - that frequently results in no touchUp being sent (or possibly just not received, I suppose).

Has anyone else run into this issue? Is there some blindly obvious solution we just haven’t thought of?

Cheers,

Pippin

Profile
 
 
Posted: 09 February 2009 11:07 AM   [ Ignore ]   [ # 1 ]
Rank
Joined  2008-10-28
Total Posts:  21
New Member

Wanted to add a refinement to the above, as I’ve been thinking about it this morning.

I realise now that what’s actually causing the problem is that when you move your finger quickly, the upEvent will happen *outside* the MovieClip of the thing you’re trying to move. So, you touchdown on the movieclip, which gets caught by its downEvent handler, then drag quickly and release before the MovieClip has “caught up” with where your finger is. Then, when you release your finger, the MovieClip isn’t under it, and so doesn’t receive the upEvent.

So, with that addition, does anyone have a clever way to have that movieclip find out about the upEvent that happens somewhere else (which is, after all, the continuation of a touch that started *on* the movieclip)…

I’ll continue to investigate, anyway.

Profile
 
 
Posted: 09 February 2009 12:20 PM   [ Ignore ]   [ # 2 ]
Rank
Joined  2008-10-28
Total Posts:  21
New Member

Welcome back to my own private learning process. I solved the problem in the end by, well, trying lots of things that didn’t work, and then reading the TUIO class more closely and seeing it had exactly what was needed. All I did in the end was add the following line of code to my downEvent handler in the Rotatable class (actually my extension of that class):

TUIO.addObjectListener(e.ID, this);

All that is doing is registering my Rotatable object’s continued interest in the blob that just got put down on it. That means it’ll receive TouchEvent.MOUSE_UP events even if they don’t happen *right on top of it*, solving the problem we were having. i.e. It means that even if you’re dragging and release an object before it has time to “get under” your finger (because of lag, say), it’ll still hear the up event and react appropriately.

Actually, I’m mildly surprised this isn’t already in there. Then again, it probably is and I just missed something.

Hopefully my wild ramblings here in this thread will help someone else smile

Profile
 
 
Posted: 09 February 2009 12:52 PM   [ Ignore ]   [ # 3 ]
Rank
Joined  2008-12-17
Total Posts:  68
New Member

Thankyou for your ramblings.  This seems to be a mod that would significantly enhance the feel and response of any MT device. I hope Seth is listening. I would love to hear his commentary on this and whether it is already a part of tbeta.

 Signature 

Not until the words outweigh the silence.

Profile
 
 
Posted: 09 February 2009 06:26 PM   [ Ignore ]   [ # 4 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

Well the problem, why this is occurring is due to a number of reason… the main one being you guys just don’t have fast enough cameras. And as a result you are experiencing this lag… if you were to use 60fps or greater camera then this wouldn’t be a problem. Never the less you have a nice solution to it for all the people that don’t have fast cams out there.

 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 09 February 2009 08:36 PM   [ Ignore ]   [ # 5 ]
RankRank
Joined  2008-12-10
Total Posts:  208
Jr. Member

I don’ think that framerate has anything to do with the issue - touchlib/tbeta will report a blob, and if it loses that blob, that should always be considered a ‘touch up’ event - at 6, 60, or 600 frames per second that event would always be triggered the same way.. there was a blob, and now there’s not. 

Events happening out of scope is the bane of AS3 programmers dealing with event listeners - I’ve run into this exact problem many times tracking mouse-clicks as well.. the down-click starts on an object, the mouse moves out of that object’s scope, and the up event gets sent to whatever other object the mouse happens to be hovering.  The solution I’ve usually used is to attach the ‘down’ event listener to the object, which dynamically attaches that object to a global ‘up’ listener.  Ideally only the ‘active’ object is ever attached to the ‘up’ listener, so other object’s ‘up’ actions don’t get triggered accidentally.  When there’s only one input device (mouse pointer), this works well, but MT could potentially have an infinite number of ‘active’ objects.. so that solution goes right out the window wink

 Signature 

22” LLP-LCD ftw
TUIO Smoke (Windows / Linux) - http://projects.edencomputing.com/projects/tuiosmoke

Profile
 
 
Posted: 09 February 2009 08:54 PM   [ Ignore ]   [ # 6 ]
Rank
Joined  2008-10-28
Total Posts:  21
New Member

Yeah, I’m not too sure it’s really a framerate problem either. We’re running the display at 100fps (the PS3Eye version of tbeta). Now, I’m sure that the final interaction isn’t happening at 100fps, of course, but it’s certainly pretty fast. The motion you use to “throw” something can easily out-move the framerate, though I find. Life is weirdly fast - I still get freaked out seeing myself in the PS3Eye when it’s running at 120fps in Alex’s test app. Just looks unnatural!

As to the event listener problem you’re talking about cicada, sounds familiar. That said, I do think that the “addObjectListener” code I mentioned above gets around the issue you mention of potentially the “wrong” upevent getting caught, because it specifically passes the blob ID that it wants to be told about… seems safe to me. At the moment anyway!

Profile
 
 
Posted: 09 February 2009 09:47 PM   [ Ignore ]   [ # 7 ]
Avatar
RankRankRankRankRankRank
Joined  2007-04-08
Total Posts:  2294
Moderator

Yeah this really is independent of framerate. The software should report the correct events regardless. Just as a mouse can move faster than the object falls, the object still reports the right event (or at least it should).

We’ll have to look into this to see if it’s a bug or not. We have some updates in the tuio clients we’ll be posting in due time.

 Signature 

Follow me on:
My Website - Youtube - Twitter - Linkedin

Profile
 
 
Posted: 10 February 2009 07:15 AM   [ Ignore ]   [ # 8 ]
Rank
Joined  2008-10-28
Total Posts:  21
New Member

Hmmm. Well, you guys are definitely the experts and I look forward to seeing the new stuff you’re up to. I’ve seen a bunch of bits and pieces in the AS3 libraries that look like you’re on a nice track for making it all more streamlined and so on - though I must say that it’s already really quite easy to work with.

That said, is it true the the object will necessarily report the right event? Seems like it could easily be an oddity of Flash’s event system, where Events are relative to where they happen, rather than represented as a kind of semantic sequence - e.g. mouse down, move, mouse up. As cicada was saying, above, it seems like it’s possible even with the mouse events to move an object “too fast” and thus to lose the mouseUp because the cursor was not over the same object at the exact moment of releasing the button.

*That* said, I don’t really understand all this all that well. For instance, what *is* is exactly that causes an object to sometimes lag behind the touch point in a multi-touch application? If it’s not the frame-rate, which it doesn’t seem to be, then what is it? It’s clearly the same “blob” involved, because the object will lag behind and then catch up - a bit like it’s elasticated. But where does that lag come from in the first place? Is it from the update() in Rotatable code (for example) or something?

In connection with that, I notice you don’t seem to use Flash’s “starDrag()” and “stopDrag()” methods, and I vaguely wonder if those, being “native” might improve responsiveness of dragging, rather than manually updating an object’s x and y? Perhaps those methods simply don’t work in this instance… again, I’m a little ignorant here.

Profile
 
 
Posted: 10 February 2009 02:52 PM   [ Ignore ]   [ # 9 ]
Avatar
RankRankRankRankRankRank
Joined  2007-04-08
Total Posts:  2294
Moderator

Stop and start drag are both things that only work with the mouse. They’re tied into how the mouse operates and that’s why we cant’/don’t use it with touch. All the above issues can be solved, it’s just a matter of working out the code.

 Signature 

Follow me on:
My Website - Youtube - Twitter - Linkedin

Profile
 
 
Posted: 01 July 2009 06:13 AM   [ Ignore ]   [ # 10 ]
Rank
Joined  2009-05-04
Total Posts:  20
New Member

I test this approach of adding TUIO.addObjectListener(e.ID, this); in reotatableScalable but the pb stills!

Remark: I use TUIO reactivision for testing this

 Signature 

Building 54” DI Table
Developping MT app for Media Center

Profile