Robert Jan Kila
website

Piston_projects
Universe 5.x and later
Size: 53 ko
Platform: Mac/PC

infos:

Piston tutorial
 
In this tutorial we explain a simple technique for animating a piston without having to allocate a dozen of keyframes. Because it is not (yet) possible to apply a constraint to each extremity of the same bone, we have to think of a trick to make it work.
Step 1 - model objects
Let us start with a simple construction of a piston and an axis. Open the project
Piston Begin.prj and look at the objects drawn and the way they are linked.
Normally the piston is moving due to an explosion of the gas. The piston moves a handle which rotates a turnwheel. The turnwheel rotates an axis (which eventually rotates the wheels: a very simple explanation of how an engine works. :-)

Step 2 - placing nulls and a bone
First we begin to place two null objects: Eff Main axis and Eff Axis target, as you can see in the picture. Link the latter to the first null.
Second, place two null objects again (or duplicate the first two) and link them together as shown in the second picture. Name the nulls: Eff axis duplicate and Eff axis duplicate target.
Well so far so good. Next, place a bone from "Eff axis duplicate target" to "Eff Axis target". Hit the
Esc key to terminate the operation. Now we have one bone and a joint end. Select both the joint end and the bone, and choose Add IK Handle from the Character menu.

We are nearly there. All the ingredients are placed but not yet constrainted. First of all we apply a rotation constraint to the null objects. Select "Eff Main axis" and choose Rotate from the Constraint menu. A window will appear, telling you that the animated channels will be removed in order to apply a constaint. Hit the OK button and click on "Eff axis duplicate". Open the Constraint Editor (Constraint Menu) and check if the name "Eff axis duplicate" is there.


Next, select the null "Eff axis duplicate" and enable the green triangle. Move the slider to 2 seconds, open the Info Window and type 360 in the Y-rotation field. To keep the null rotation during a period of time we must repeat its rotation.
Open the null "Eff axis duplicate" by clicking on the blue triangle. Open de Yaw (y) channel by clicking on the blue triangle. Set the Time mode to Frame mode.
Select frame 0 till 354 and choose Repeat under the bent arrow icon (cycling) in the project window toolbar.

So, when the rotation is at 354 degrees it will retern to 0 degrees and begin from start to rotate. Now we have a continues rotation of the null. Set the time mode to Time again, and close all cel-rows by clicking on the blue triangles OR choose Close All under the blue triangle icon in the project window toolbar (at the top of the Project Window).

.
Window toolbar

Select Bone 1 and choose under the Constraint menu Position, click on "Eff axis duplicate target" (click OK when a window prompts up) and hit Esc when you are done. Select Joint End and constaint its position to "Eff Axis target". When done hit Esc again to terminate the operation. Now, do exactly the same with the "IK Handle 1".

All right it is time to try our piston rotating. In the camera window click on the preview icon. Hey, something went wrong. Bone 1 is not moving in the Y direction!! So we have to link our bone to the Y-axis in order to move only in the Y direction when the nulls are rotating. To do so, select Bone 1 and open Joint Editor under Hierarchy menu. Click on the pop up menu at Link Type. Choose Custom...

Check the Lock X Position and the Lock Z Postition checkbox and Lock X, Y and Z rotation and close the window. Hit the preview button in the camera window again and see how the bone stays on the Y axis.


Roll (z) cells


At least but not last we make an extra null : Eff Cylindermover. Make sure it is a box shape and positioned at "Eff axis duplicate target". This is the null object at which the real piston will be linked. It is just for our convenience. Finally one constraint has to be applied. Select the box null and constraint it to the "Eff axis duplicate target".
Now, link all objects to the right effectors:
- link the turnwheel (with the children) to the "Eff main axis"
- link the Axis to the "Bone 1"
- link the Piston (with the children) to the "Eff Cylindermover"

Hide all effectors and our piston is ready to go. So fire away ;-)

Project window
with linked objects