Calculate speed from position values

Hi, I have moving objects in touchdesigner, with tx ty tz values and I would like to calculate the speed of object.

I tested it out with a kinect :

average channels in math > slope, but I am not sure if it is the right way,
grateful for any advice

Hey @sherlynn,

The Slope CHOP calculates speed when having a position as an input. So first pass the positions into a Slope CHOP with the result being speed in all 3 directions. To now calculate the general speed, append a Math CHOP and select Combine Channels > Length which will give you the length of the speed vector and hence the overall speed.

The image here just shows how you can confirm this: First you specify a speed that is distributed among 3 random directions. The Speed CHOP, given a value calculates distance so it can be seen as returning a position. The “Calculated Speed” section then is then what I described above, taking the position, calculating the speed in all directions and calculating the summed up speed.

Hope this helps

@snaut thank you for your reply! I think it’s working ?
but the slope result from the kinect is quite erratic, I will have to figure how to smooth it better somehow

Hey @sherlynn,

if using the Kinect v1 or v2 you can try to smooth out things a bit with the parameters available on the “Smoothing” page. Otherwise the Filter CHOP and the excellent 1Euro Filter option might give you good results.
When adjusting the filter it can be generally useful to make use of the Trail CHOP to compare the original and the smoothed channels. For that plug the original values into the first input and the output from the Filter CHOP into the second input.

Hope that helps