# How can one rig a Stirling engine?

I've only done a very little animation and rigging before, and I keep getting stuck trying to rig the pistons and rotor of the Stirling engine I built.

What should happen is that one piston moves in as the other moves out, and through the attached arms, the rotor should spin. Animating the rotor and the piston heads was easy enough, but getting the arms that go from the piston heads to the end of the shaft arm to move right endlessly confuses me.

Each end of each arm moves differently over the course of a cycle. With animating, I can't figure out how to interpolate so the arms stay where they should.

With armatures, I have tried for a while, but keep getting stuck when it comes to how to have one end of a bone moving in a circle while the other end is moving in a straight line.

Edit: The answer below elegantly resolved my problem, so i've updated this with the finished .blend file in case it's useful someone else.

Here is the .blend file:

• In your final file PistonPin doesn't fit Arm very well, if you look carefully. At some point Arm intersects Piston (going a bit inside through it) – Serge L Mar 14 '18 at 0:52
• @SergeL Yes, i noticed that too. I'm not sure what refinements would fix that, but for my purposes, the way it is is fine. Actually, now that you mention it, i want to export the model to Verge3d, and the animation doesn't work with that, so i'm going to have to keyframe it like a character animation, in which case i can fix that. At least now i can use this animation to get the position of the pistons so it isn't difficult to position the arms. – kim holder Mar 14 '18 at 1:15

## 1 Answer

This is really not my area, but here is what I could come up with purely using constraints. I suppose you could use a similar setup with a rig by applying a equivalent constraints to the bones.

Parent an empty to the rotor $A$ at the correct arm tip position $B$.

Parent both arms $C$ and $D$ to $B$.

Correctly position both pistons $E$ and $F$. Add the same constraint setup to both consisting of (by this order):

1. One Limit Location constraint set to Local Space where you only limit both minimum and maximum $X$ and $Y$ to $0$

2. One Limit Distance constraint set to On Surface to $B$ and adjust the distance parameter to match the arm shaft length.

After setting up both constraints switch their order so the Limit Distance is before the Limit Location. This is so the Limit Location is set before and guarantees the pistons aren't inadvertently moved out of place.

After that proceed to add the same constraints to both arms in the form of one Track To pointing to the corresponding pistons $E$ or $F$.

If you animate rotation of the rotor you should end up with a setup similar to this:

Disclaimer: Due to unknown facts as Haunt_House points out there seem to be a slight lag/imprecision with the pistons moving slightly out of sync with the rest of the setup. This is likely due to limitations on the way Blender calculates constraints, solving the last one without guaranteeing the first one is still met.

• I would just add that for the rotor you only need a single keyframe and a generator for the rotation on the z axis. – cegaton Mar 13 '18 at 0:04
• This will work well, i tried this too but got confused. I've never used this kind of constraint before. Let me see if i can do this now... :P – kim holder Mar 13 '18 at 0:05
• @cegaton A generator? I've never used one of those either. Is there an example you can point me to? – kim holder Mar 13 '18 at 0:08
• F-curve modifier: generator? I'll see if i can look around and figure it out. – kim holder Mar 13 '18 at 0:20
• @DuarteFarrajotaRamos It's not really unknown. Blender calculates the first constraint and then, from the new position, it claculates the next one and doesn't care if the first one is still satisfied. It's the big limitation of constraints that they don't search for a solution that solves them all simultaneously. – Haunt_House Mar 15 '18 at 1:41