When rigging props, one of the most important things to ensure, is that characters can pickup and put down the props within a single scene. This is achieved through dynamic parenting. There are many ways to create dynamic parenting in a rig, the most common being to key a constraint. Personally, I don't like using that method because it involves created key frames as part of the rig (even before animating!) In this blog, I'll explain my personal favorite method.

Demonstrating the Result

Dynamic Parenting without Keying Constraints

Here's the logic behind it:

A Primary CTRL CRV is used to directly constrain the main props group. The translate and rotate values of this primary curve is controlled using a combination of 2 other curves - Global CTRL and Parenting CRV. This setup is achieved using the Blend Colors node in the Node Editor, and controlled using a custom attribute. The Primary CTRL CRV is then hidden.

Blend Colors Node:

In the Node Editor, add the Primary CTRL CRV, Global CTRL and Parenting CRV. Press tab to create a new node, and search for "blendColors". Blend Colors is a node that takes 2 attributes as input, combines them using a slider, and gives one output. We'll use it for combining the Translate values of Global CTRL and Parenting CRV.

Each input color can have a separate R, G and B value. For us, the Translate X, Y and Z values are automatically mapped to R, G and B.

Connect Global CTRL translate to Color 1, Parenting CRV translate to Color 2, and Output to Primary CTRL CRV's Translate. Create another node and repeat the process for rotation. When connecting rotation values to the blend colors node, Maya will automatically create a unitConversion node. This is because rotation values are in degrees, but blend colors needs a float value from 0 to 1.

When you're finished, you should have something that looks like this:

Add and Configure a New Attribute

Add a new attribute to the Global Control:

Name: Prop FollowType: FloatMin: 0Max: 1

Go back to the node editor, and connect this attribute to the blenderattribute of both blend color nodes. Now this Prop Follow attribute can be animated to move the prop from the Global CTRL to the Parenting CRV based on requirements.

How to Implement in Animation

The Parenting CRV needs to be constrained to the character's wrist control when the character begins interacting with the prop. Once constrained, the Parenting CRV will permanently move along with the character's wrist. Then we can use the Prop Follow attribute in the Global CTRL to shift control of the prop between the 2 curves. We can decide when we want it to follow the Global CTRL and when to follow the Parenting CRV. Of course, there are some irritating problems to deal with. For example, since the Parenting CRV moves independently of the Global CTRL, the Parenting CRV will remain at the origin when initially positioning the prop. We can take care of such problems through scripting.

Clean Up with MEL Scripting

We can create Shelf buttons to synchronize translate and rotate values between our Global CTRL and Parenting CRV, to make animation a lot simpler. To start, open the Script Editor and clear History.

This transfers the translate, rotate and scale values from Global CTRL to Parenting CRV. Deselect objects, and copy the script to shelf. Edit the shelf button, and copy the last line to the first line. This ensures that Maya will clear selection before running the rest of the script.

Move Parenting CRV to Global CTRL

Button 2:In this button, we want to do the exact opposite: transfer values from Parenting CRV to Global CTRL. To do this, simply copy the previous script, interchange the 2nd and 3rd lines, and make the following alteration:

In the 2nd line, change -tgl to -rIn the 3rd line, change -r to -tgl

-ris used for selecting an object-tglis used for SHIFT selecting an object

Move Global CTRL to Parenting CRV

So, when you make the change, you are instructing Maya to first select Parenting CRV, and then Shift select Global CTRL.This button can be useful when a character needs to put the prop down.

Button 3:

Parent Constrain to selected object

As you already know, for this rig to work, we need to constrain the Parenting CRV to the character's wrist control, or whatever control the prop needs to interact with. Lets simplify this with a script.

To generate this script, SHIFT select the Parenting CRV and go to Constrain --> Parent

Yes, you will get an error saying there were not enough target objects, but this is what we want. This way, when animating, we can simply select the character's control curve and click this button and voila! The rig is ready to use! Just be sure to remove the error line when converting the script to a shelf button. Also add the clear selection command from the previous buttons at the end of the script to make it cleaner.

Note:On the 3rd button, be sure to SHIFT select the Parenting CRV. If you select it normally, then when you run the script, Parenting CRV will be the only object that is selected, resulting in the same error. We need to preserve existing selections for the constrain to set up properly.

MaintenanceAfter completing all of this, I ran into a small problem when animating with the rig. When you import this prop into another scene, the names of it's objects change, so you get an error when using the buttons. Now, if you're not going to change the name of the prop scene, then there's a simple way to get around this:

Just import your prop into a new Maya scene, copy the new names of the Parenting CRV and Global CTRL, and replace the old names (in your shelf button scripts) with these new names. And that's it! Your rig is ready to use!