HAND TRACKING & LEAPMOTION

Good morning I am creating a project where I would like that with gestures I can control the movement and color of some particles. I am working with leapmotion, I have created the particles and set their movement depending on the hand gestures, now I would like to establish 6 areas/zones on the screen, depending on area the hand enters I would like the particles to change color and also the sound they are associated with change… could you help me and guide me step by step in this process?

Hi @fedsch,

is the screen divided into 6 equal areas/zones?

the Leap Motion CHOP returns transform channels tx, ty, and tz for each hand that you are tracking. You can now use the tx and ty channels and interpreting them as row / column values. So let’s say you have 2 rows and 3 columns, using a Math CHOP you would multiply the tx value by 3 and convert it to an integer by rounding. Similar for the ty channel, which you multiply by 2 and again round to an integer.

These two values you now can convert into a cell index: with each row having 3 cells, multiply the ty value again by 3 and now add the tx and ty value together.
As a last step use a Fan CHOP which

takes one channel and generates 2 or more channels. It sets to 1 one of the output channels while all others are 0, based on the input channel’s value. The first output channel is index value 0, the second, 1, and so on. If the input value is above N-1 or below 0, the value can be clamped, cycled or ignored.

For example, if the value of the input channel at a certain frame is 4, and if the CHOP outputs 8 channels, the fifth channel will have a value of 1, and all other channels will have a zero value at that frame.

The input is assumed to have 1 channel which contains integer values; fractions are truncated and extra channels are ignored. The output channels are binary (0 or 1) channels.
Fan CHOP - TouchDesigner Documentation

Your result now is 6 channels of which one will turn on upon your hand entering one of the 6 zones.

From a old workshop I have this file here which needs 25 audio files to properly work, but the idea should come across. Instead of a Leap Motion, I’m using a 2D slider to simulate this.

SoundMatrix.toe (16.5 KB)

Hope this helps a bit
Markus

Thanks, I’m gonna try this out and let you know :slight_smile: