Procedurals eh? Back in my day the only procedural we had was noise, and we didn’t have no racken-fracken vertex paint or look-at controllers neither… Oh, wait, where was I. That’s right. Getting to an interesting tutorial. Now I don’t know much about other programs, and since there’s a requirement to use Autodesk software I’ma gonna go with that setup – Creating a piston that’s dirty to your liking. So, on with the show! Just to let you know, this tutorial is set up assuming you are familiar with the MAX interface, yet will stay as simple as possible. Seasoned MAXers can just skim through and pick up the basic concepts. We’re going to start with setting up the piston. If you already have a piston model you wish to use, just skip down 2 paragraphs to learn how to get it to work like a piston. Now let’s go in and create our simple piston. Remember: This can always be scaled later to fit your robot model.
Start by creating a new scene. In the top viewport, create a CYLINDER with RADIUS=20, HEIGHT=100, and HEIGHT SEGMENTS=10. Name this cylinder ‘pistonBase’. After creating this cylinder, right-click in the front viewport. Select the MOVE transformer and move the cylinder along the Y axis, while holding down SHIFT at the same time. Create a copy, naming it ‘pistonTop’ and set it with the HEIGHT=20 and the HEIGHT SEGMENTS=5. Move and copy the cylinder a second time, naming it ‘pistonMid’, and set the HEIGHT=130, the RADIUS=10, and the HEIGHT SEGMENTS=10.
With the FRONT window still selected, select pistonMid and click on the ALIGN tool. Click on pistonBase with the ALIGN tool – a window should pop up, giving you various options. First, check the X box, and make sure both CURRENT OBJECT and TARGET OBJECT have CENTER selected. Click APPLY. Now check the Y option, and set both CURRENT and TARGET to be MINIMUM. This will align both bases of the cylinders, then click OK. Now select the pistonTop, and click the ALIGN tool. Click on the pistonMid with the align tool. Check the X box and center it, click APPLY. Now click the Y box and set both columns to be MAXIMUM, and press OK. That should align the tops of pistonTop and pistonMid. If you have any trouble with this first part, retrace your steps before going on. Oh, and save, just for fail-safe purposes…
From here, we are going to get into controllers, dummy objects and linkage. It’s simple stuff, but later on, you may want to go into the manuals to read about them in detail and the cool abilities they offer you.
Go to the Create panel now, and click on the HELPERS button. Click on DUMMY and create one, larger than pistonBase in the front panel. Name it ‘baseDummy’. Use the ALIGN tool to align it to the center of the pistonBase and the bottom, by first checking X and Z with both columns at CENTER, then check Y with CURRENT at CENTER and TARGET at MINIMUM. This will bring it to the bottom and center of the pistonBase. Now go ahead and create a slightly smaller dummy, naming it ‘baseLookatDummy’. Align this to the bottom of pistonBase as well. Now MOVE-COPY it to the top of the piston, naming this copy ‘topLookatDummy’. Align it to the top center of pistonTop by setting X and Z checked and both columns at CENTER, then Y checked with CURRENT at CENTER and TARGET at MAXIMUM. This all should have been done in the front panel, so if you have any trouble, retrace your steps and make sure the front panel is selected at all times. The next steps are for assigning controllers.
Controllers are essential to animation. They determine how your object animates. Depending on the situation, you may want to change controllers from the default ones to get specific animation effects. Take a look through the manuals or MAX Online Reference for more detailed information on controllers.
Select baseLookatDummy. Click on the MOTION panel. Make sure that PARAMETERS is the clicked button, then click on the ASSIGN CONTROLLER rollout. There should be a box with a bunch of green arrows next to text. These are the animation controllers. Click on the one that says ROTATION. Then click the ASSIGN CONTROLLER button on the left hand side of the MOTION panel. The controller you select from that popup window is the LOOKAT CONSTRAINT. Click OK. You should get a whole new rollout labeled LOOKAT CONSTRAINT. Under this rollout, there should be a button that says ADD LOOKAT TARGET. Click it, then click on the topLookatDummy. This should add it to the box below that button. Right-click in the front panel or click on the button again to deselect it. Now click on topLookatDummy, and set its rotation controller to be a LOOKAT CONSTRAINT. Select the baseDummy as its target. That’s it for the controllers. Onto the last part you will be working - linkage.
Right now you should have what looks like a piston, with 1 dummy object at the top, and 2 dummies at the bottom. The dummy objects are great tools, as you can do all kinds of animation tricks with them without needing to directly modify a mesh – and they don’t get rendered. Select pistonBase and click on the SELECT AND LINK button. Link the pistonBase to the baseLookatDummy by dragging a line from the pistonBase to the baseLookatDummy. Now select the baseLookatDummy and link it to the baseDummy. Select pistonTop and pistonMid and link them to topLookatDummy. Select topLookatDummy and link it to baseDummy. From this point on, if you were to select the baseDummy and move it, everything should move with it. Not only that, but if you were to move topLookatDummy, the piston should function much like a piston, no matter where you move it. To take this and make it work on your robot, all you have to do is link the baseDummy to the base of your robot so it moves with it, and link the topLookatDummy to the part that moves with the piston.
And that’s it, for now. I have to add the dirtying a bit later, as this took much longer than expected. Any questions just email me, or even email or reply to this post if something needs to be changed or explained differently. Look around tomorrow for the addition of the dirtying tutorial. Oh, and I also have a MAX file that goes with the tutorial that I should be able to upload, even as a ZIP file.