Rigging a Versatile Weapon Bone for Maya
- This is an advanced-level tutorial for character artists, which explains how to configure a character-held item such as a weapon or some other prop. This item could be attached to a character at multiple locations (not just one hand), and then animated to change positions from one location to the next.
The goal of this tutorial is to build a weapon rig that allows the character to hold and manipulate the weapon with different grips in different hands. We also want to be able to sheath the weapon either on the hip or the back. We will achieve this by skinning the weapon to a weapon bone, and then use a series of point helpers, position, and orient constraints to achieve fluid motion.
Although this tutorial was done in Maya, the concepts translate directly to 3ds Max.
See Rigging a Versatile Weapon Bone page for 3ds Max tutorial.
Properly adding a new weapon bone
Create a bone somewhere near the grid off to the side of the origin and behind the feet. Name this joint as Weapon. Select the Weapon joint first, then select the Bip01 joint. Use Skeleton > Connect Joint [Options] > Parent joint option. This will add the Weapon bone as a child of the Bip01. This is ideal to prevent Animation Compression from effecting the Weapon bone compared to having the Weapon bone as a child of say a hand bone which is several nodes deep in a skeleton and would be affected much more by compression such as fingers and toes are.
Use Skeleton > Connect Joint [Options] > Parent joint to add a Weapon bone.
Base Location for the Weapon
Create a Locator
Using the Animation Shelf, create a Locator and name it Loc_Free. Point snap by holding the v key while translating the locator somewhere along the top of the spine, then translate in negative Z, behind the skeleton rig. This will be the alignment and reset position for the weapon mesh and weapon bone and will not be apart of the skeleton.
Create a Locator named Loc_Free and point snap it to the upper spine, followed by an translate offset behind the character.
Constraining the Weapon mesh
With the pivot point already set on the handle of the weapon mesh, select the Loc_Free locator first, then the dummy_weapon mesh (or placeholder mesh).
Select the Locator, then the mesh weapon so the weapon will contraint to the Locator on the back of the character.
Still using the Animation Shelf, click on Point Constraint, then Orient Constraint. The weapon should have snapped and rotate to match the Loc_Free locator. Now rotate the Loc_Free locator (not the mesh) so that the weapon faces downward and flat against the back of the skeleton, if is not already.
Do not rotate the weapon Mesh node, rather the Locator to orient the weapon into place.
Constraining the Weapon bone
With the Loc_Free locator selected, next select then the Weapon joint and press Point Constraint, followed by Orient Constraint. The Weapon joint and the mesh should have the same Local Axis. Select both nodes and choose Display > Transform Display > Local Rotation Axes menu to see that the Local Axis indeed line up.
With both Weapon Mesh and Joint selected, use Display > Transform Display > Local Rotation Axes for debuging the setup.
Remove temp mesh constraints
Expand the weapon Mesh node, named dummy_weapon in this example, to select and delete the two temp constraints.
Expand the mesh weapon children in the Outliner and delete the *_pointConstraint1 and *_orientConstraint1 constraints under the mesh. This was temp to align the mesh and joint together.
Note: The Weapon joint constraints are needed for setup and should not be deleted.
Skin Weapon mesh to Weapon bone
Parent or Skin the temp weapon mesh to the Weapon Bone so they stay together for the rest of the setup.
Create Locators for Hands
Create Left Palm Locator
Create another Locator and name it Loc_L_Palm. You can temporary use a Point Constrain and an Orientation Constraint by selecting the Bip01_L_Hand joint first, then the new Loc_L_Palm locator to get it close to the hand. Then delete the newly created constraints as they are not needed.
Align Left Palm Locator
Using the Move Tool Settings by double clicking on the Move icon in the Toolbox, set Move Axis to Object to move the locator along the same space as the hand joint.
Double click on the Move Tool to open the Tool Setting. Then change Move Axis to Object to offset the locator to the Palm.
Parent Left Palm Locator
Parent the Loc_L_Palm to the Bip01_L_Hand by middle mouse button (MMB) drag of the locator node onto the hand joint in either Outliner or Hypergraph.
After pressing F to focus the selected Hand joint in the Outliner, MMB drag the Loc_L_Palm locator on top of the Bip01_L_Hand joint.
If you select the arm bone in the viewport, you can pick-walk with the down arrow key til Bip01_L_Hand is selected, then right click in the Outliner and press F to focus and expand the Outliner tree to see the joint node. Then you can middle mouse drag the Loc_L_Palm locator node over top of the Bip01_L_Hand joint node.
The other method is to select the locator as the child, and then select the hand joint as the parent and press p key to parent.
Confirm that the Loc_L_Palm locator is parented to the Bip01_L_Hand joint.
Display Left Palm Locator Local Axis
The locator will now stay with the hand while having it's own rotation and offset for the weapon. To see the Local Axis of the locator, go to the Attribute Editor (Ctrl+a) for the transform node and check Display Local Axis in the Display rollout.
Select the Loc_L_Palm transform tab in the Attribute Editor, then under the Display group, check Display Local Axis.
Note: You will most likely adjust rotation on the locator(s) after completing the weapon bone setup and seeing the weapon in hand, so don't stress about the rotation at this time.
Create, Align, & Parent Right Palm Locator
Create another locator and name it Loc_R_Palm. You can point snap and/or use temp constraints such as orient constrains to align it with the Bip01_R_Hand joint. Remove any temp constraints if used, then position the locator within the palm of the hand. Parent the Loc_R_Palm locator to the Bip01_R_Hand joint. Turn on Display Local Axis either by the Display > Transform Display menu or via the Attribute Editor.
Repeat the first four steps in Create Locators for Hands for the Right Palm locator, including Display Local Axis.
Constraining the Weapon bone to each Palm Locator
Constraining the Weapon bone to Left Palm Locator
Now that you have two new Locators in the palm of each hand, select the Loc_L_Palm locator first, then select the Weapon joint. Press the Point Constraint button on the Animation Shelf, followed by the Orient Constraint button.
Select the Left Palm Locator, then the Weapon bone. Press the Point and Orient Constraints on the Animation Shelf.
The Weapon joint should snapped halfway between the Loc_Free and the Loc_L_Palm locator. The previous Weapon joint constrains have been updated to append the new locator as part of the Weapon bone setup.
Note: Don't worry about the mesh weapon's rotation as it will look odd at this stage of the setup. This will be fixed later on.
Constraining the Weapon bone to Right Palm Locator
Now Select the other Locator in the opposite hand, and reselect the Weapon joint. Use the Outliner or Hypergraph to ensure you have the Loc_R_Palm locator and Weapon joint selected. One again from the Shelf, click Point Constraint and then Orient Constraint.
The Channel Box will now show more Weights as Loc_R_Palm, the third locator, is a new constraint for the weapon bone.
Adjusting the Weapon bone constraint Weights
The Weapon joint should be floating half way between the two hands and slightly behind the spine toward the Loc_Free locator. This is good, as by default, all constraints are at 100% weight. Select just the Weapon joint, and go to the Channel Box. Under SHAPES is the Weapon_pointConstraint1 and Weapon_orientConstraint1 listed. Under both will be the locator names with W0, W1, and W2 in the Channel name. Since the locators are named properly, you will see how much weight each locator has.
Adjust weight to only one Palm
Now using the new contraint weights, lets position the weapon to one of the hands.
Change Loc_Free and one of the Palm locators to 0. Now the the Weapon joint has favored the other palm locator.
Zero out the weight on all but one of the Locators to have the weapon snap into the other locator's position.
Below the Weapon_pointConstraint1 is the Weapon_orientConstraint1 which you can click on to constraint name to expose the channels. Once again, change the value to 0 for the matching locator of the opposite hand that the Weapon joint is not set to as well as the Free channel.
Zero out the orient weight for the same Locators used for position to have the weapon match the rotation of the locator.
Rotate Palm Locators for Weapon to match Hand
Use Loc* in the Outliner's text field filter to make it easier to select Locators for rotation
Adjust any rotations on the Palm locators to align the weapon with the palm. Usually this is 90 or 180 degrees along one or two axis. Always check Display Local Axis for the Locators before trying to adjust rotations of the locators for the weapon mesh to match up with the hand.
Some Palm locators need rotation on multiple axis for the weapon to align with the hand.
Preview the Results
When the arm is moved, the hand and the Weapon bone will move together since they are children of the arm. If you need to do an animation with the weapon in the other hand, just switch the weight for both point and orient constraints on the weapon bone.
Rotate joints in both arms, then shift the weapon bone constraint weight between palms to confirm the setup is working.
Expand the Weapon Setup
Add more locators and parent them to the closest ideal joint(s). Give the locators proper names, then use both point and orient constraint on the Weapon bone for the new locators to be added to the Weapon joint list of weights.