I have the two points, now I want to make the ball move between these two points.
vectorToPoint (even if the name sounds different) should return a vector (Help: This command will return a normalized vector that points from p1 to p2)
Multiplying the vector with 0.2 I get the following error:
Traceback (most recent call last):
File "<string>", line 12, in ?
File "Vizard7.py", line 16, in ?
futurePos = pos + (ball.vector * 0.02)
TypeError: can't multiply sequence to non-int
Extracted an example code:
import viz
import vizmat
viz.go()
p1 = [0,0,0]
p2 = [1,0,1]
#This will print out [0.707,0,0.707]
print vizmat.VectorToPoint(p1,p2)
ball = viz.add('../resources/models/ball.wrl')
vector=vizmat.VectorToPoint(p1, p2)
print 'ballVector',vector
pos = ball.get(viz.POSITION)
futurePos = pos + (vector * 0.02)
|