How to do use an if statement?

Hi guys,

I’m new to TD and I’ve used this tutorial [url]THP 494 598 | Generative Design - Shape | TouchDesigner - YouTube to make the shape work with the kinectv2 (via hand movement along the x and y axis).
And now i would like to create a function, which can play a soundfile when I’m not moving the geo/shape. And i have no clue how to achieve that :astonished:
I was thinking of an if clause like:
when geo value (x,y) is constant trigger/start soundfile z
and if geo value is unstable stopp soundfile z.

Thank you for your help and hello to everyone :wink:

Once you get the Geo’s movement into CHOPs you can use a Slope CHOP to tell if the value is changing. Then Logic CHOP can give you a solid 1 or 0 for on/off.

There are lots of ways to do this, this is just one using CHOPs.
IsItMoving.toe (5.53 KB)

1 Like

wow niice :slight_smile: thnx a lot

ok I’ve still got a problem. my kinect values are generally not stable, even if i don’t move my hand at all they’re going all over the place (from 0.1600 to 0.1500 or 0.1400) :I

how would you smooth out these values? i tried using the filter chop, but couldn’t get it to work.
is there an expression which could be added to get rid of the digits after the 0.1?

ok forget my question just discovered the limit op. But is there also an python expression to do this?

You can use ‘any’ python expression you want in the Expression CHOP. Just google your python expression question and you’ll find something for it.