Engine rigging help

Hey folks! So, I am quite new in rigging and I am having some trouble on my new project

The thing is that, when I rotate the crankshaft, the piston heads should only move in the Z axis (done), and meanwhile, the piston rod should rotate in order to follow it.
The movement is done already, but it is the rotation onto the rod I just can’t figure out how to do.

So, summing up, I’d like to know how I can make the rod to rotate according to the piston head movement (Z), so they can be aligned by the cylinder found on top of the rod, and at the same time without escaping the crankshaft.
Thank you.

IK Bone Chains are the answer, or Constraints, Drivers and Empties - both system featured in the blend file below.

Just press Play to see them working, then select the method you prefer to use in your engine. There are two V6 engine rigs in there plus several single piston, etc.

Cheers, Clock. :smiley:

cylinder-problem-ver3.blend (1.83 MB)

Hey Clock, thanks a lot for the model!
I will definitly try applying some of these ways into my model.
I really appreciate your reply, again, thanks a lot for the help!
Cheers mate!

Easiest way is the armature method, using an IK chain - watch the chain length as set in the IK constraint - it should go only back to the “Stroke” bone. Remember also to lock the axes of the “Stroke” bone in the bone’s Object > IK Panel.

Just to reiterate - I have used scripted expressions in the blend file - you must check “Auto-run Python Scripts” in User Prefs > File tab or they won’t work.

Cheers, Clock.