in the ofxMultiTouchListener.touchX functions I notice that I can easily get the identifier of a touch:
int touchId
So far I have successfully got two-finger touching to work in the Simulator (though I will probably have to buy a developer license soon for proper testing.) But I have a question about touch behaviour.
Say I touch the screen with three separate fingers, one after the other (for brevity, fingers 0-2.) While keeping fingers 0 and 2 down, I lift finger 1 from the display. How does this affect touchId? Are the active touchIds 0 and 2, or is finger 2 [touchId 2] bumped down to touchId 1 to fill the gap?
Similarly, immediately after the above action, I place finger 1 back on the screen. What touchId does it take - its previous one, touchId 1, or a newly vacated touchId 2, or if I’ve somehow totally misunderstood the mechanism touchId 3?
This is probably covered in Cocoa Touch documentation, but that goes on forever and a day. If anyone could summarise the explanation so I can carry on with confidence, I would really appreciate it.
Although I’m not sure of the answer to that off the top of my head,
but, even if it re-assigns the identifiers when you lift one of the earlier fingers, it would be easy and fast enough to write a tracker that would keep them organized. You could probably even reconstitute ofCvBlobTracker to do this.
so you should be confident that whatever you are thinking of doing is possible.
Hi anny, the touchId’s are persistent and do not shuffle around when you lift/add fingers. Everytime you add a finger it gets the lowest available id. Identical to how TUIO assigns Ids. So in your example scenarios:
if you lift finger 1, fingers 0 and 2 remain with those Id’s.
when you put any finger down after that, it gets Id 1 again (As it is the lowest free id)
This is actually not how Cocoa handles it, but ofxiPhone has the persistence tracking in it.
Cool, that’s what I was hoping for. If Cocoa doesn’t handle it like that, then I take it in that framework you would have to program the persistence handling into your application rather than it being provided? Sounds like a nightmare!
I seem to be getting input lag if I touch the screen repeatedly (not rapidly, at a moderate pace and occasionally even slower than that) about half of my touches aren’t picked up. All I’m trying to do is switch bools in an array keyed by touchId e.g.
On the ofxMultiTouch touchDown event, touches[touchId] should be set to true, while touchUp should have the opposite effect. Doesn’t work that simply. I added a printf to each event and it seems that touchDown isn’t called half the time. :?
In a very early version of ofxiphone, if you doubletapped, it wouldn’t count as a single tap, only a doubletap. As of 2nd April 2009, a single taps are also sent along with the doubletap. http://code.google.com/p/ofxiphone/sour-…-m&start=20
not sure when the OF package went out, but if you get the latest from SVN you can just ignore the doubletap and the single taps come in through as usual.
As you’ve replied so quickly I guess I should follow this up! How do I remove the touchDoubleTap event then? I don’t want to mess around with the addon; do I just not declare the event function?
Edit: OIC. Updated ofxiPhone and it works perfectly now. Thanks :o
hey, how do you mean remove the touchDoubleTap event? You can’t remove it, the event exists whether you like it or not You can ignore it. I.e. do nothing in the function. But that won’t change the way the addon parses and sends events to your testApp. You just need a new version of the addon. All you need to do is download the new one and overwrite your old ofxiPhone files.
If you are uncomfortable checking out from SVN, just:
if it asks you for username/password, just cancel that so you login anonymously.
Then you can copy (drag) the contents of that over your existing contents of ofxiphone. (in addons)
restart xcode
There are a few new files in this ofxiPhone, so you need to manually drag and add them to xcode. If you open the ofxiPhone folder under addons in xcode, and in the finder you can see which ones they are (ofxiPhoneAlertsXXXX). Just drag these into xcode into the ofxiphone/src folder, and leave the ‘import file’ settings as default.
If you are double touch simultaneously then effect of particular function will not acomplished.
so double touch tab will not accomplish.
i am not know why its not working?