Drive KeysThis tutorial teaches you how to set up and use drive keys. What Are Drive KeysDrive keys are actually the same as normal key frames. The difference is, a normal key frame changes the value along time, while a drive key changes the value along another value. ![]()
Drive keys are mostly used in rigging. Drive keys can be connected to any value. The object that contains the value is called the driver, while the object that has its values changed is referred to as being driven. Set-upOpen a new Maya scene and create two cubes side-by-side.
The idea here is to have the left cube rotate along the X axis when the right cube goes up along the Y axis.
Step two - Select the cube on the right and, in the set driven key window, click load driver. You'll see its attributes loaded into the top half of the window.
Step three - Select the left cube and, back in the set driven key window, click the button "load driven". Its keyable attributes will be loaded into the lower half of the window.
Step four - The attributes we want to key together are the up axis, or translateY, and the rotateX axis.
Select both of the attributes by clicking on them. If you want to have multiple attributes driven by the driver attribute translation Y, you can left click and drag to select multiple attributes, or hold the shift key. To deselect driven attributes, ctrl click. Also, you can only have one driver attribute.
Step five - Now that we have our attributes selected, click the button in the set driven key window "key".
Step seven - Now go back to the set drive key window and click key again. Select the right cube and move it up and down. As you can see, when you move it up and down between the two key frame positions, the left cube rotates.
Select the key frame node. Open the attributes editor.
The pre infinity options are for before the key frames. The post infinity are for after the key frames. It lets you select what you want to happen to it when there aren't any key frames at those times. For a quick example, set the post infinity settings to linear. Now when you move the right cube up and down, the left cube will continue spinning as long as the right cube is above two units. Anything below this would be classed as pre infinity. Alternative Way
Since drive keys are identical to key frames (mostly), you can convert key frames to drive keys. Here's one way of doing it.
Step four - Set another normal key frame.
Step two - There are a lot of key frames that we don't need, because the only value we've changed is the rotation along the X axis. So delete all the key frames by selecting and hitting the delete key and leave the keyframe named pCube_rotateX.
Step three - Select the key frame and open the attributes editor. We need to change the time attribute.
Step four - Our two key frames' time values are kept in the time column of the key frames' table of attributes. Depending on which frame you selected to make your second key frame on, yours might look different than the one in the picture. We need to set the first key frame's time attribute to 0 and set the second one to 1.
Now when we convert this to a drive key, it will have the left cube stationary when the right cube's translation isY=0 and it will be rotated 45 degrees when the rght cube's translation isY=1.
Step six - We now need to connect the translationY value of the right cube to the input value of the left cube's key frame. This would normally be connected to time if it was a normal key frame, not a drive key.
Step seven - In the output side, go to the translate attribute, display its sub attributes, and select translateY. In the inputs side, click on input. In most cases, this will automatically set up the connection of the value of translationY to the input value. If it doesn't, click the "make" button.
This works essentially just like a drive key. When you move the cube up to a point where it's Y value is larger than one, the cube will have rotated 45 degrees. I don't recommend doing it this way because Maya doesn't consider it a true drive key. This can cause problems later on. Also, it it will need to create a conversion node in between the key frame and the translationY attribute. Conclusion
Thank you for reading this tutorial. I hope this has taught the basics of drive keys. |
|





















