Animating a truck and trailer

I’ve got a truck and a trailer. In the real world, the movement of the trailer is always fully caused by the movement of the truck. The trailer is always pointing towards the pivot point, and it only moves in the direction it is facing (it doesn’t slide sideways).

I’ve tried putting both the truck and the trailer on a path, but that does not give the right result because the trailer still moves sideways.

in the file attached you find one of my attempts, using the locked track and limit distance

I’m trying to model this behaviour in blender, but have some trouble in getting it to work. How can I limit the movement of the trailer that it won’t slide sideways?

Attachments


TruckExperiment.blend (350 KB)

Check out http://3d-synthesis.com/tutorialsenglish.html .They’re for 2.49 so they wont run correctly in 2.6, however the articulation setup still works.

finally got a sort-of working solution. I made a function which calculates the new position of the trailer based on the old and new positions of the truck. And I added that as frame change listener.
THe solution however only works in forward direction, and only for hard-coded truck and trailer.

Also, I have not set up the script as autorun. You should if you really plan to use it.

Attachments

FollowTest.blend (413 KB)

@jonim8or: I looked at your code, posted and the other link. As a frame change solution it looks good, however there is one line that needs to be changed.

if bpy.context.scene.frame_current == 0:

If you reference the context while rendering your code can crash. But there is no need to reference the context in this case because the scene is given to you when the event is fired.
Change to…

if scene.frame_current == 0:

If you are still interested, check out this tutorial on how to rig and animate a trailer truck https://atlantis-studios.net/how-to-rig-and-animate-a-semi-trailer-truck-in-blender-2-83-in-8-minutes/