Object avoidance tdu.position and vector

I did this a while ago… used scripting as you mentioned. I think I used the vector in the way you described. Here’s some of the code I used:

av1 = tdu.Position (av[1, 'tx'], av[1, 'ty'], av[1, 'tz']) av2 = tdu.Position (av[2, 'tx'], av[2, 'ty'], av[2, 'tz'])

for b in bp.rows(): #print (b) if b[0].val != 'BalloonID': bpos = tdu.Position (b[1], b[2], b[3])

[code] # if an avoidance is nearby, try to get away
dist1 = bpos - av1

		if dist1.length() <= avoidDist:
			#print ("balloon " + b[0] + " is " + str(dist1.length()) + "m from left hand")
			bpos += (dist1 * 0.02)

		dist2 = bpos - av2

		if dist2.length() <= avoidDist:
			#print ("balloon " + b[0] + " is " + str(dist2.length()) + "m from right hand")
			bpos += (dist2 * 0.02)

[/code]

Looks like I used a fraction of the vector. This was only a peripheral part of the project, and we only had two weeks for the whole project! - I’m sure you can find a smoother way.

And yes - I was borrowing from boid codes too.

Bruce

Bruce