maya> animation>Drive Keys

Drive Keys

Share |

This tutorial teaches you how to set up and use drive keys.

What Are Drive Keys

Drive 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.

click to enlarge

click to enlarge

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-up

Open a new Maya scene and create two cubes side-by-side.

click to enlarge

The idea here is to have the left cube rotate along the X axis when the right cube goes up along the Y axis.

Drive keys are normally set up using the "set driven key" window, but there are alternative ways. I'll show you one other way of doing it later on.

Step one - Go to the animation menu set, then go to animate>set driven key>set...

click to enlarge

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.

click to enlarge

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.

click to enlarge

Step four - The attributes we want to key together are the up axis, or translateY, and the rotateX axis.

click to enlarge

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.

click to enlarge

Step five - Now that we have our attributes selected, click the button in the set driven key window "key".

Step six - Now that we've got our first key, we need to reposition the two objects. Move the right cube up 2 units along the Y axis (it doesn't have to be exact), and rotate the cube 45 degrees along the X axis (it doesn't have to be accurate).

click to enlarge

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.

The process is the same for setting any drive key. Since a drive key is just like a normal key frame, it has all the settings as a normal key frame. To access them, select one of the cubes and go to window>hypergraph: connections.

click to enlarge

Select the key frame node. Open the attributes editor.

click to enlarge

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.

For more on normal key frames, try this tutorial.

http://www.3dtutorialzone.com/tutorial?id=96

Just like normal key frames, you can set as many drive key frames as you want. Since it's difficult to reset your objects to the exact same position they were when you set the drive key frame, it helps to select your model that has the driven attribute and go to animate>set driven key> go to previous or next.

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 one - Create a new scene and create two cubes side-by-side.

Step two - Select the left cube and press S on your keyboard or go to animate>set key. This will set a normal key frame. Now change the frame to a different frame - it doesn't matter which.

Step three - On the new frame, rotate your cube 45 degrees.

click to enlarge

Step four - Set another normal key frame.

Now that we're done creating a normal animation key frame, let's convert these to drive keys.

Step one - Select the animated cube (not the right cube), and go to window>hypergraph:connections.

click to enlarge

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.

click to enlarge

Step three - Select the key frame and open the attributes editor. We need to change the time attribute.

click to enlarge

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.

click to enlarge

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 five - Close the hypergraph. In the view port, select both cubes and reopen the hypergraph.

click to enlarge

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.

Select the right cube and then hold shift and select the key frame. Go to window>general editors>connection editor.

click to enlarge

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.

click to enlarge

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.

Good luck.

turbosquid
Visit The3dStudio.com
Home Tutorials About the Author Site Map
User Agreement Privacy Policy ©2015