Multitouch structure and index order

drakfyre's picture

Hey, first off, I had never been to this site before yesterday, and I am just having a blast trying out all the new inputs and outputs available here. Also, a quick forward: I am not very advanced with Quartz Composer, so if what I am doing seems round-about, apologies in advance. Anyway, I was working on making a little "breakout box" for the multitouch structure that returns all 11 touch coordinates, or null if a coordinate is not active. This works great, except for one problem: when I add a finger to the touch pad, sometimes the actual index where the previous finger was stored gets the new finger's coordinates, and then the previous finger gets stored in the new coordinate set. It appears that the id moves as well, but I don't really know how to wire it up so that it will automatically "switch" the outputs based on the ID to avoid this problem. Any help on workarounds would be appreciated.

Comment viewing options

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

smokris's picture
Re: Multitouch structure and index order

You're currently using "Structure Index Member" to access the eleven touches? Try "Structure Key Member" instead.

When you refer to structure members by Index, members are always assigned sequential integer values starting at zero. You can also refer to structure members by Key --- a text string that identifies one particular structure member.

When hovering over a structure output in the composition editor, the Index is shown before the colon, and the Key is shown in double-quotes:

In the case of MultitouchPatch, the patch provides a structure of up to eleven touches. Each time you place a finger on the touchpad, that touch gets an ID (between 1 and 11), preserved until the touch is released. You can refer to a touch using this ID as the Key (whereas, in this case, structure Indexes are not guaranteed to mean anything).

indexkey.png27.36 KB

drakfyre's picture
Re: Multitouch structure and index order

I've attached a diagram of my current system that uses the index rather than the key. The problem with switching to the key system is if I had say x1 and y1 mapped to the key "1" as opposed to index 0, if I put a finger on the touch pad, there's no guarantee that the first finger touched on the pad will have key 1, which is actually a worse problem than the fingers flipping around occasionally. Is there a method you could think of to rewire this in such a way so that the x1 and y1 outputs ALWAYS represent the position of the first finger down?

index.png90.59 KB