delete an image using kineme multitouch

sberla's picture

Anyone know how to set the multitouch info for deleting an image? like, importing an image on a layer using image importer and deleting it using the kineme moultitouch? sorry for my english :) Thanks a lot.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: delete an image using kineme multitouch

there are a bunch of ways one could do this. maybe hit testing the object. option click prefs to enable private patches. at this point you can test when your touch one is over an object and the then you could use a conditional to check for a second touch which will delete an object. with multi-touch its arbitrary how you delete objects. you need to develop your own gesture for that type of thing.

sberla's picture
Re: delete an image using kineme multitouch

Thank you Dust, but I'm new with QC. I cannot uderstand clearly what should I do. I wonder if I can change any controls or values in the MultitouchPatch-OneStrokePaint.qtz to obtain this result. Is there any compositions where I can see and study the way to do that? Thanks again!

dust's picture
Re: delete an image using kineme multitouch

yes there are a bunch of examples of hit testing here on kineme. so first you need to understand that the touch info is stored in a structure . a structure has indexes and keys that let you pull out information from the structure. think of it as a list. iterators are used to loop through the list sort of dealing with all touches at one time.

to start let's just deal with one touch and no iteration. attach a structure index patch to the multitouch patch set it's index to 0. now attach another structure index or structure key member to the index patch set to 0. I forget if the touch data is pulled out by key. a key is a name like xpos. it will get that specific data. the cool thing about qc is normally you can use an index instead of a key. so if you attach another index member to the one all ready attached to the multi touch patch and set it's index to 0 it will pull out the data first in the list for touch 1. I forget which is first in the list as I'm on my iPad but for example let's assume index 0 for touch one is your x pos. now attach another index or key member to the touch one index and set it to number 1 this will pull out the second item in the list. let's again assume it's y pos. so now for touch one you have x and y position data. there are actually a bunch of ther data in the list but let's now just deal with x and y.

so now that you have your x y data for touch one you need a Boolean truth to turn on and off a patch. let's add an instruction patch so you can visualize some data. now attach a structure count patch to the multi touch patch and attach that to instruction patch. now when you touch with one finger the structure count should read 1 when touch with two fingers it should read 2 etc.. so now you have a way to tell how many fingers are being used. now let's add a conditional patch. feed the structure count into the conditional and set it to when structure count equals 1. now attach the the output of the conditional to the enable of the instructions patch. what this will do is turn on or show the instruction when one touch is present. now set the conditional to when count equals 2 and then change the initial index member index to 1. now this will only display the instruction when there are two touches present.

now set it back to 0 to get the first touch but leave the conditional set at 2. add a hit test patch and sprite make width and height of sprite to be .5 now set hit test width and height to be .5 set hit test patch x and y to be the same as the sprite. now feed in your touch one x and y to the test x and y of the hit test patch. what this will do is test if your finger is over the sprite. now add a logic patch. set it to and take the first output of the hit test patch and attach it to the logic patch. now take a the output of the conditional patch that is set to 2 to the logic patch now attach the logic patch out put to some other sprites enable than the one your testing. what this will do is test to see if your touch is over the sprite and test to see if you have a second touch down. so if you touch over the sprite then touch down with a second finger it will enable a hidden sprite maybe.

there are some good gesture macros by smorkis ghat will show you how to pinch etc... if you are unable to toggle on off something with the instructions above let me know and I will whip up example

sberla's picture
Re: delete an image using kineme multitouch

Well Dust, you are the best teacher ever. Absolutely. But I cannot solve my problem..man, I feel really stupid :( Anyway, I have to ask you a few questions again: - what is an hit test patch (I have the 3.1 version)? - what kind of conditions I have to set for showing the bottom layer (over that I have a picture) not completely, but gradually with the same shape of the touch imput?

Hope to explain my request clearly. Thanks again.