Gradually move back to position 0

Hello! While I’m still relatively new to touchdesigner, I’m currently in the process of creating an interactive projection for my college project. Unfortunately, I’ve encountered a roadblock in my progress.

The project utilizes a SOP sphere which tracks movement along both the X and Y axis through optical flow technology. I’m currently facing an issue where I’m attempting to set the sphere’s parameters to the origin point of 0,0,0 if there is no movement detected for a period of ten seconds or more.

The movement of the sphere has to be gradual. Any suggestions or guidance on this matter would be greatly appreciated!

Hey @Selinayilmaz,

the solution might depend a bit on what kind of data your are getting from the optical flow portion of your network. Do you get already positional data or is it velocity data?

Either way a combination of the Slope CHOP and Math CHOP (“Combine Channel” parameter set to Length) will give you a magnitute of the movement. Now when that falls below a certain threshold you can use a Count CHOP to Increase Count. Adding a Logic CHOP will allow you (via the Off When Outside Bounds entry of the “Convert Input” parameter) to have a 0-1 channel that is 0 if the Count CHOP’s channel reaches a certain value (for 10 seconds at 60fps it would be 600). Now you can use that value to multiply the position of the sphere and Filter or Lag it.
If your position is calculated as well, then use this 0-1 channel as a Reset for the position.

Does this help a bit?
cheers
Markus

Cheers
Markus

1 Like

Hello! Thank you so so much for you very prompt reply!

Thank you for your guidance, which proved to be highly informative. However, in my attempt to implement the steps you provided, I may have missed something or made an error, resulting in the sphere being placed at the center and transformed into a point. Would you be so kind as to give a bit more detail regarding the process you suggested? :slight_smile:

I greatly appreciate your help and thank you again for your thoughtful response. :slight_smile:

Kindly note, I have included a screenshot for your reference

Hey @Selinayilmaz,

i prepared a little file here with a workflow that might work for you using the techniques mentioned above.
Mainly the movement is determined and if it stops, the Count CHOP starts counting up. When reaching 600 (10 sec * 60fps) we set the output to 1 and use this to crossfade between the last position of the sphere and the 0 position. This is done using a Cross CHOP and to make this a gradual movement, I’ve added a Filter CHOP to smoothly crossfade between the 2 positions.
Once the movement starts again, the Count CHOP is reset (second input) and the sphere will gradually move to the new position again.

sphereMovement.toe (10.0 KB)

Hope this helps
Best
Markus

1 Like

Thank you very much @snaut !
This is the solution I was looking for. It works perfectly.

Thank you for your help! :slight_smile: