zoo space switching

david | | Tuesday, December 4th, 2007

In maya the parent-child relationships between objects cannot be animated directly, but you can achieve the same result using constraints. A "child" object is constrained to several "parent" objects and the constraint weights are maintained so that at any time one constraint is weighted fully and the others are zero. In this way the child behaves exactly as if it is jumping between different parents when the constraint weights are changed.

This kind of system is often refered to as "space switching" (and other names like "dymanic parenting" and "multi constraints"). The steps to set up constraint based space switching are reasonably simple but it's not something you would want to do manually everytime. An automated solution is quicker and ensures consistency.

In this "walk-through" I will look at the "zoo space switching" system which is an integral component of the zooCST (zoo Character Setup Tools). It is very easy to use and includes a powerful object-based right-mouse-button menu that allows you to change parents and, at the same time, reorient/reposition the object to compensate for the jump that would otherwise have occured when the child object was swapped to the new space. Changing space without affecting the child object's world-space position is essential when you are animating.

For the zoo space switching system to work it is important that you have correctly installed the zoo version of dagMenuProc.mel. This is a modified version of the one installed with maya. It was changed to let the zooToolbox hook into maya's right-mouse-button menu. (More about this here).

Ok, so here's the walk-through, beginning with a look at the UI which is a tab in the zooCST window (you may need to scroll across to the right to see it).

zooCST_spaceSwitchingTab.jpg

It is worth making the point here that if you use zooCST to build a rig, then space switching is created automatically for you. This Space Switching tab is there for setting up anything extra that you might want. In fact it can be used for absolutely anything. You can use it as a stand-alone tool. And that is what I will demonstrate.

I started by creating a sphere which I named object1. With object1 selected I clicked the load target button to load it as the control object.

spaceSwitching01.jpg

zooSpaceSwitching does not constrain the child object directly. Instead it requires the child to be parented to what it refers to as a space node. I could have created the space node manually using the maya Edit|Group menu, but the group to self button in the zooSpaceSwitching UI does the same thing and gives the new node a logical name. Clicking group to self and then load target a second time loads both the control object and the space node object (which is called object1_space).

spaceSwitching02.jpg

Next I created three parent objects and named them spaceA, spaceB and spaceC. I selected the three new objects and clicked the add space button.

spaceSwitching03.jpg

As you can see, the three objects are now listed as Parents on the left and also as Space Names on the right. Space Names are the names that appear in the right-mouse-button menu and you may want them to be different to the actual parent names to make the menu more descriptive. Or maybe you want to abbreviate. In the next picture you can see I have selected spaceC in the Parents list and entered SP3 in the input field on the lower right and then clicked change name.

spaceSwitching04.jpg

Then I clicked build space switch.

That's all there is to it. The group above object1, called object1_space, is now constrained to each of the parent objects. The constraint weights are being controlled by a new Parent attribute that has been added to object1. Here is a snapshot of the channel box.

spaceSwitching07a.jpg

object1.parent is set to spaceA which means that it if spaceA is rotated or translated, then object1 will move exactly as if it was actually parented to spaceA. I can change spaces by choosing a different parent using the drop-down list in the channel box as shown here.

spaceSwitching07b.jpg

A quick look at the hypergraph connections display gives some idea of the way the nodes are all hooked together.

spaceSwitching05.jpg

It is not important to understand all the connections, but it is worth pointing out the use of several condition nodes here - because you will probably notice them floating around at some stage.

And here is a snapshot of the channel box with object1_space selected.

spaceSwitching07d.jpg

Notice the constraint weights (in yellow) indicate that spaceA is the current parent.

The problem with using the channel box to change parents is that it causes the child object to jump from one parent to the next (assuming that the parents are translated and rotated differently). What we really need is the ability to reposition object1 under spaceB so that it ends up in exactly the same worldspace position as when it was in spaceA. In fact that was the reason that zooSpaceSwitch created the extra space node - object1_space is constrained to the parent objects and that leaves object1 free to be repositioned as required.

If I right-mouse-button click when the cursor is over object1 (doesnt have to be selected) then I get this menu.

spaceSwitching08a.jpg

Those three "parent to..." items can also be used to switch parents, but when I do it from this menu some extra calculations get done and object1 maintains its worldspace location. There is no jump.

It takes a bit of practice to use space switching in animation. You need to get used to setting keyframes for the child object on the frame before you switch as well as on the switch frame. Once you get the hang of it though it is very easy to use. I especially like it for animating a character picking up and putting down props.

2 Comments »

  1. nice tool. What Maya versions are supported?

    Comment by zzz7net — January 11, 2015 @ 8:06 am

  2. The zoo scripts and the methods they use will work with any version of maya. But as you can see from the date, this post is 7 years old, and the zooToolbox has been changed since then. Many of the scripts have been converted to python, but have not been updated since 2011.

    If you are looking for a quick, clean, off the shelf solution for space switching then this is a good one http://www.paolodominici.com/products/zvparentmaster/

    But if you are a TD and want to get your hands dirty, then studying and modifying the old zoo scripts is a great way to learn.

    Comment by david — January 11, 2015 @ 11:40 am

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Based on a theme by Roy Tanck