When the rotation axes you need to rotate around are not aligned with the world axes, an "orient group" is needed (also called "offset group"or "reset group") in order to keep the animation control with zero values. Simply aligning the animation control and freezing transforms won't work because freezing transforms will reset the rotation axes to world. This script finds the rotation values necessary to properly align an animation control to the correct rotation axes, creates a group above the control and assigns the rotation values to it, so that the control can have zero transforms, but still be aligned as needed.
HOW TO USE
First create your animation control and place it so that its pivot point is where you need it. Then, open the GUI and assign one or two planes, by selecting either a face or 3 vertices and clicking assign, and the animation control. If one of your rotation axes is aligned with one of the world axes, like in the figure A below, you will only need to assign one plane, else you'll need two. You can use the radio buttons next to each plane assignment to select which axis will aligned with that plane. Finally, click "Orient control".
The script will create a new group named "your_control_name"_orientGrp, and will parent the animation control to it. You can now parent this orient group to your hierarchy and lock all channels, since this group should not be animated.
If the control is not visually facing the way you want, you can rotate it and then freeze transforms, that won't affect the rotation axes since those are coming from the values in the parent group.
Fig A - Y axis is aligned with the world |
Fig B - No axis are aligned with the world |
Choosing the 3 vertices to select can be confusing depending on the shape of your mesh, the vertices don't need to be defining a face. You might be selecting vertices on the flat side of a hinge, or on the edge loop of the elbow. Watch the video below to see a practical example.
INSTALLATION
To get the Animation Control Orient Tool, download the script file and save it in your "maya/version/scripts" folder:
Download lr_ctrlOrientTool_UI.py
Then run the following code in the script editor (make sure to be in a python tab):
import lr_ctrlOrientTool_UI
reload(lr_ctrlOrientTool_UI)
You can save these lines in a shelf button for easy access.
If you don't want to download the file you can just copy the code below to the script editor and drag it onto your custom shelves so you can access it at any time (remember to save your shelves before quitting Maya)
No comments:
Post a Comment