Trying to simulate Follow Path constraint using just python

(BigEfrom84) #1

I am working on a roller coaster project using just python to create the animation. Based on work by Jeremy Behreandt here i have got the coaster to follow the path and align with the curve tangent. My problem lies in not being able to figure out how to rotate the coaster to account for the tilt of the curve
But i can’t figure out how to align coaster to tilt of curve
I have attached the blend file

Thanks in advance for your help
PythonAnimation03.blend (507.1 KB)

(ajcdfin) #2

Hey, I don’t know much coding but I think it has to do with the “Follow” check box under curve > “Path Animation”, but that is just a guess. Also why is your ‘rotation’ space set to ‘Quaternion’ ?

(BigEfrom84) #3

I have the tangent vector at some point on the curve.
tangent = coord_tangent[‘tangent’]
then i align the object to the curve with the following
rotation = tangent.to_track_quat(‘X’, ‘Z’)
object.rotation_quaternion = rotation
… works fine this far …
tilt = … known

What i am looking for is how to apply an additional rotation to get the object to account for the tilt of the curve at that point. I know the tilt angle around the tangent vector.