From the course: Rigging Mechanical Objects in Maya

Set up joints to control the pistons - Maya Tutorial

From the course: Rigging Mechanical Objects in Maya

Start my 1-month free trial

Set up joints to control the pistons

- Now we're going to go ahead and start rigging the pistons. Now, the pistons are basically going to be driven by the crankshaft, so the rotation of this crankshaft will determine how the pistons move. Now typically, in a real engine, the pistons would be driving the crankshaft, but we're going to flip that on its head because it's going to make it for an easier rig. Now how we're going to do this is with a joint chain, so we're going to use a joint with IK to control the angle of the piston rod, as well as the height of the piston. So the first thing we want to do is draw a joint. Now we can do that in one of two places. We can go into Skeleton, Create Joints, or probably the easiest way is to go into the rigging shelf and here's the joint tool. So I'm going to go into the front view. We're going to draw a joint that's the same height as this piston arm, so from the center of the crankshaft to the center of the piston. I'm going to select my joint tool, click once here right around the center of the crankshaft, once up here around the center of that piston axle and then hit "enter" and that's really all the joints that we need to draw for this one, and then I'm going to zoom in and make sure that this is centered. So, I'm going to center this on the crankshaft, and I'm going to center it again at the top. I'm going to select just this joint and center that on the piston. So now we have this joint and we need to slide it over a bit, so I'm going to go ahead and just slide it over in Z so that it's centered to that piston arm. So now that we have this, we need to find a way to attach it to the crankshaft, and then also get it to point in the proper direction. While attaching it to the crankshaft is pretty easy, we can do that with Hierarchy so I'm going to go into my Outliner, scroll down, here is my joints. Go ahead and middle click, move those up and just drop them over crankshaft, so now the joints are a child of that crankshaft. So when I rotate this, that joint will rotate with the crankshaft. But we don't want the joint to rotate like this. We want it to continue to remain pointed up. We want the top of this to move along the axis of the cylinder, so we can do that with an IK handle. So, I'm going to go here and do "create IK handle." Select the bottom joint, top joint, hit "enter" and we should have an IK handle here. I'm going to go ahead and move that up to the top so we can see it. Now this IK handle will allow, will basically keep this pointed in the direction that we want, so when I rotate this, if we keep this IK handle positioned exactly where we want, the piston always point towards the cylinder. Now I'm going to go ahead and undo this. So in order to get this IK handle to stick, we need to attach it to something. So I'm going to attach it to a locator. We can create that in one of two places. We can create a locator here, or we can go Create, Locator, and that usually comes in at the origin which is way down there so I'm going to go ahead and bring this up. What we're going to do is we're just going to turn on "Snap, Snap to points" and I'm going to go ahead and snap it to the center of that joint. So now I've got this locator, and if I take this IK handle and make it a child of that locator, it will go ahead and keep it in place, so now when I rotate this, that joint is always going to be pointing up no matter where I rotate it. One thing you'll notice here is that if we look at it from the front view, you'll see that this is actually going off of center. It's not actually staying centered to the cylinder so we need to correct for that, and we can do that with what's called a Constraint. So I need to create something that moves up and down with that crankshaft, so what we can do is just create another locator. So I'm going to go ahead and create a locator here, move that into position here. In fact, I still have "Snap" turned on and actually I do, I want to snap this right to where that joint is. So I've got that locator here, and I want to make that part of the hierarchy so I want to go ahead and middle click and drag that over crankshaft. So now under Crankshaft we have two objects. We have the joint chain as well as that locator, and both of those will rotate with that crankshaft. So now I can use this locator to affect how the IK handle moves. Now, what I really want to do is I want to get that IK handle just moving up and down along one axis, which is the vertical axis, and the vertical axis in this case is "Y." So I'm going to create what's called a point constraint, so I'm going to go ahead and open up my hierarchies here, so I want to constrain my IK handle to this locator, so I'm going to select this locator first, control select the IK handle, then I'm going to go into Constrain. I'm going to create what's called a point constraint. Now by default, it should have it turned on to Maintain Offset, which we want, and then the constrain axes, by default is all, but we only want to constrain this to the vertical axis so if I constrain it just to the "Y" axis, it will only move up and down and mimic the motion of that locator, so when I click "add" here, it should work, so if I rotate this, this now rotates up and down only in that vertical axis, so let's take a look at this from the side here. You'd see how now it's always moving along that center. So now I have the fundamental structure in place to attach my pistons.

Contents