Piston animation with bones

Hi (me again)

in case the constraint system does not work for any reason I tried to get
that type of setup working with bones but mh was not really able to get
that one working. I followed a very old tutorial but was curious if there is
not a more modern way with bones to it

I added a link in case somebody knows it. Pistons seem not to be a popular
topic for Blender and I hardly found anything new - most is 4 to 6 years old.

http://dl.getdropbox.com/u/239525/piston_child_of_constraints.blend

http://dl.getdropbox.com/u/239525/Screen%20shot%202009-10-27%20at%2011.16.48%20PM.png

I posted the following to the Tutorial forum earlier this year, but it never showed up. So here is another attempt:

The earlier discussions of rigging a crank and piston system that I have found online all seem to end up with direct or indirect mutual constraints between the connecting rod and the piston. Typically, the rod tracks to the head of the piston, and the piston copies the location of the tail of the rod. That is a natural model of the physics, but in the context of Blender’s animation means that at least one is always chasing the previous instead of current position of the other, and so the connection between the rod and piston wobbles.

But using a simple but cunningly constrained IK setup, everything can be done with no cyclic dependencies.

Start with a model to be rigged:


The aim is to connect things so that rotating the flywheel works the piston smoothly.

Add an armature, and extrude the obvious deforming bones, one each for Crank, Rod and Piston:


Now flip things round ready for IK:

  • disconnect the Rod and Piston bones from their parents;
  • reverse the direction of the Rod;
  • copy the Piston bone, rename the copy ‘PistonGuide’ and reverse its direction;
  • remove PistonGuide’s parent, and make it the parent of both Rod and Piston;
  • reconnect Rod and Piston to their new parent, and make them hinges;
  • extrude a ‘PistonIK’ control bone from the Crank.
    The result looks something like

    ;
    I’ve moved the head of the PistonGuide to the middle of the cylinder, but it doesn’t really matter where it is along the axis.

To add the IK constraint, switch to Pose mode, and make PistonIK the IK target of Rod, with a chain length of 2:



(Minor grumble: if the IK constraint had a head/tail parameter for the target bone, as some others do, we wouldn’t need the PistonIK bone at all, but could just target the tail of Crank directly.)

Now comes the trick. The rod can just be allowed to rotate, in the usual IK fashion. But we don’t want the piston to rotate, we want it to slide, and IK doesn’t do slides. Fortunately, it does do stretches. Of course, we don’t want the piston itself to stretch, which is why we need the extra guide bone. PistonGuide has all three rotation axes locked, but the stretch parameter set to maximum:

With the IK in place and appropriately constrained, rotating the Crank bone makes Rod and Piston bones move exactly as desired:


Finally, we can hook up the mesh. Give the Crank bone a ParentTo constraint to the Flywheel, and the Crankshaft, Rod and Piston ParentTo constraints to their respective bones. Rotating the flywheel now drives the piston.

Best wishes,
Matthew

Hi

I found your model in a different thread now.

For some reasons I cannot rebuild it on my own.

I cannot add the IK Solver. It does not accept the bones name.

http://dl.getdropbox.com/u/239525/piston_armature.blend

What version of blender are you using because
I do not see the loc x,y,z buttons you mention in this part:

Now comes the trick. The rod can just be allowed to rotate, in the usual IK fashion. But we don’t want the piston to rotate, we want it to slide, and IK doesn’t do slides. Fortunately, it does do stretches. Of course, we don’t want the piston itself to stretch, which is why we need the extra guide bone. PistonGuide has all three rotation axes locked, but the stretch parameter set to maximum:
Attachment 88373

Strangely your demo file runs smooth on my side.

Yous should send the mods a message.
this tut is very needed and hard to find.

Attaching your armature into my scene than works fine.
Still I am curious about why my steps don’t follow.

Good find. I meant to include it in my previous post, so here is the link for anyone else interested:
[ATTACH]78890[/ATTACH]

For some reasons I cannot rebuild it on my own.

I cannot add the IK Solver. It does not accept the bones name.

Probably just a typo in the name of either the object or the bone. Here is your file with the IK solver added and constrained, but the mesh not yet hooked up to the armature:
piston_armature.blend (535 KB)

What version of blender are you using because
I do not see the loc x,y,z buttons you mention in this part:

Those buttons only appear if the bone is part of an IK chain, so if you couldn’t add the solver you won’t see them.

Best wishes,
Matthew

silly mistake

I was not able to apply the IK because I entered the bone name into
the OB field and not the Bone field.

All works like a charm now.