Object avoidance tdu.position and vector

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

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

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

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

in SOP & numpy
viewtopic.php?f=22&t=3794