Notifications
Clear all

[Closed] Speed Space Follow

I’m trying to recreate the effect of speed space follow in pflow on a teapot. Currently, I have a point helper that is animated in position, and a teapot that is linked to it.

clearListener()
obj = $point001
tp = $teapot001
with animate on
for i = animationRange.start to animationRange.end do (
	at time i (
		currentPos = obj.pos
		lastPos = at time (i-1) obj.pos
		xM = normalize (currentPos-lastPos)
		yM = normalize (cross xM [0,0,1])
		zM = normalize (cross xM yM)
		yM = normalize (cross xM zM)
		targetMatrix = matrix3 xM yM zM [0,0,0]
		destRot = targetMatrix.rotationpart
		srcRot = tp.rotation
		tp.rotation = (slerp srcRot destRot .25)
		tp.position = obj.pos
	)
)

However, this does not produce the desired effect I’m looking for. Similar to a path constraint with follow checked.

Update: Hmmm, when I use [0,0,-1] for the upnode, it works properly. Although I don’t know why…

2 Replies

you could try replacing…

xM = normalize (currentPos-lastPos)
 yM = normalize (cross xM [0,0,1])
 zM = normalize (cross xM yM)
 yM = normalize (cross xM zM) 
targetMatrix = matrix3 xM yM zM [0,0,0]

with

targetMatrix = MatrixFromNormal (currentPos-lastPos)

or otherwize

yM = normalize (cross [0,0,1] xM ) 

should give the same result as using [0,0,-1]

Didn’t know about matrixfromnormal. Thanks for the tip!