Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Object avoidance tdu.position and vector

General discussion about anything TouchDesigner

Object avoidance tdu.position and vector

Postby bwheaton » Thu Aug 25, 2016 3:10 am

I need to make some instances avoid other objects. I happened upon tdu.position and tdu.vector, so I'm getting my object and object to avoid, and subtracting to make a vector. As far as I know, the distance of the vector will equal the distance between centers, right?

So - if I want to avoid, I want to move away in the vector direction, but I need to invert it and scale it more or less depending on closeness? How can I do something like nearLimit - ver.distance() to get a scaled vector? There's no set distance in tdu.vector, but is there an equivalent?

Worst case I suppose I could work with a fixed distance vector for my push away?

Any tips? Isn't this like a boid system?

Bruce
bwheaton
 
Posts: 337
Joined: Mon Mar 19, 2012 1:33 am

Re: Object avoidance tdu.position and vector

Postby nettoyeur » Thu Aug 25, 2016 7:57 am

sounds indeed like your implementing at least one of the boids rules.
Maybe these examples can help you:

boids pseudocode:
http://www.kfish.org/boids/pseudocode.html

on GPU
viewtopic.php?f=22&t=9151

in SOP & numpy
viewtopic.php?f=22&t=3794
Idzard Kwadijk | freelance TouchDesigner consultant | IdzArd.com
Checkout ChopChopChop.org - the TouchDesigner marketplace!
nettoyeur
 
Posts: 1170
Joined: Mon Oct 15, 2012 12:00 pm
Location: Amsterdam, The Netherlands


Return to General TouchDesigner Discussion

Who is online

Users browsing this forum: No registered users and 25 guests