Creating a Cervo Piston
tutorial written by Mobi on Tuesday 18th March 2003
In this tutorial we will create a simple cervo piston mechanism utilising constraints and skeleton bones. The maths behind Inverse Kinematics allows us to solve a variety of problems without having to always rely on constraints. As with all my tutorials this is for XSi 3.0 +, it will work with other versions but you will have to create your own model as XSi is not forward compatable.
Download the model file [ HERE ] and save into the "Models" folder in the database you will be working from. Then, click "File>Import>Model" and select "CervoDemo.emdl".
In this example, we want the blue handle to control the motion of the grey piston; as the handle moves up and down, so the handle will follow, with its end oscillating horizontally:
So, how do we begin?
First, draw a single chain skeleton (Animate>Create>Skeleton>Draw 2D Chain) in the top viewport matching the length of the blue control rod. Rename the root "MasterRt" and the effector "AnimateIK".
Then, draw another 2D chain along the length of the grey piston. Rename the root "Slave" and the effector "ConstrainedIK".
Incidentally, dont worry if your wireframe colours do not match the illustration - I have coloured mine to make them easier to see.
Now, translate *both* complete chains in the Y-Axis so the bones surround the geometry:
The next step is to make the root of the second chain ("Slave") child to AnimateIK. Select the Slave in the Explorer, then left click and HOLD the button down, drag it onto AnimateIK (you might have to expand your Master hierarchy first) then release the button when AnimateIK goes purple.
Slave is now child to AnimateIK. You can do this operation by selecting Slave then clicking the "Parent" button, on the bottom right of the display, and picking AnimateIK. Personally I find dragging and dropping for this example faster as you will see below.
This setup now means if you translate AnimateIK in X the Slave chain will move. However, we have not achieved the desired result as ConstrainedIK moves in unison with the bone and does not slide up and down in the X-Axis as we require. Undo all your translations so the bones are in the positions you drew them.
Get a null (Get>Primitive>Null) and rename it "EndConstraint".
Place a null at the same location as ConstrainedIK, make sure the Y positions are more or less exact, you will still be able to move this null later to get the exact positioning so dont worry about it too much.Again, I have coloured the null blue so you can see it clearer.
Select ConstrainedIK and make it child to EndConstraint as you did earlier with the skeletons.
Select ConstrainedIK and save a translation key at frame 1: select ConstrainedIK press "v" (selects translation) then "k" (stores a keyframe). This invokes inverse kinematics ensuring ConstrainedIK tries to stick to EndConstraint.
If you do not save this keyframe, the grey piston will not move correctly. You will now find if you translate AnimateIK, ConstrainedIK will not deviate from a straight line.
To finish, make "hornModel" child to the Master Bone, and the "rodModel" to the Slave bone. Now to move the piston, simply animate AnimateIK.
In the immortal words of my mate Ledge "Jobs'a goodun!"
Copyright © 2003 BallisticPanda.com. All