-Maya Constraint RECAP –
This is a more technical topic so I think is important to make a written RECAP of my last Turorial about the Maya Constraint:
Here the VIDEO tutorial
I want to show you how to create a parent constraint and how to plan the method to use based on the type of action you have
There’s a lot of different ways to constrain an object to an other and I’ll show you some of the more common situations using the maya constraint
It’s basically a relationship between two ore more objects, one is the TARGET Object, the one that leads the movement or the position, and the other is the CONSTRAINED object, that is influenced by the target, so it doesn’t moves independently but it’s driven by the target object
The type of constraint depends on the axes you need to constrain to the lead object: translation, rotation or scale
In Maya, if you go in the Animation Tab
and then on CONSTRAIN
you find some different types of constraints: POINT – AIM – ORIENT – SCALE – PARENT
the more used are POINT / ORIENT and PARENT
As I said before the difference between this constraints are the axes involved:
So if you constrain an object with the POINT constraint you will constrain the translation axis that will follow the lead object but you can rotate it independently
Vice versa: if you use the ORIENT constraint you can translate it but the rotation is constrained to the lead object
And when you use the PARENT constraint both the axis (translation and rotation) are constrained and follow the lead object movements
-CONSTRAINT OPTION PANEL-
When you open the constraint Option Panel you have the first box “Maintain Offset” that means that if you turn it ON: the object will be constrained maintaining his starting position, if you turn it OFF: when you will apply the constraint, the object will jumps on the target object pivot
In most of the cases you will need to turn it ON, so…always check this option before apply the constraint!
Another thing you can check are the Constraint Axes: here you can choose which axis you want to constrain
In the example we have the translation and rotation axes cause it’s a parent constraint
By default you have ALL the axes turned ON but you can turn off the ones you don’t need!
When you apply the constraint you will see that the axes constrained turned blue in the channel box, this means that you can’t animate this values
Let’s now see the different situations where you’ll need to constraint some objects
This are the different situations we will go to analyze:
This are some common situations and it’s important that, before you go to start the animation and create the constraints, you have to plan the shot!
Do it in your mind or with some sketches, because is important to decide how to do the constraint and you need to anticipate all the actions you will do with the constrained object!
Let’s start with the first situation
-Hands on Hip-
In this simple animation the character keeps his hands on his hip, so we need to constrain the hands to the hip in order to follow the hip movements, so… the hip will be the leading object that will drive the hands
In some rigs you could have the possibility to choose if the hands must follow the hip or other parts of the body (the Main control, the COG, the Head…) without manually create a constraint! Usually if this option is available, you can find it selecting the wrist control!But in case you have a very basic rig, without this option, let’s see how to manage it!
IMPORTANT: when we constrain the hands, this must be in IK mode, so switch both the hands in IK!
So we pose the hands on the hip, then…
REMEMBER THAT: to apply the constraint you always have to select the target control first, the one that will leads the movement and then the control or object you want to constrain!
So in this case: select the hip control, then -> shift -> and select the control of one of the hand, go in the Animation tab -> CONSTRAIN and choose PARENT
we choose parent ’cause we want that the hands follow the hip in both translation and rotation axes!
Open the Option Panel, be sure to have the MAINTAIN OFFSET turned ON and apply it!
So the translation and rotation axes turned blue in the channel box and now this hand is constrained to the hip, let’s do the same on the other one!
At one point he detaches the hands from the hip so we need to turn OFF the constraints in order to animate the hands!
To do that we simply select the hands controls, one at the time and we set a key
When you do this in the channel box you can see that the constrained axes turned green and you have a new attribute, the BLEND PARENT Attribute that you can animate! (scroll down in the channel box to see it)
So on the last key frame where you still need the constraint, set this attribute at 1 and add a key
in the following frame where you want to turn OFF the constraint set it at 0 and add another key, so from this point you can animate the hands!
-Hand on another character’s shoulder-
An other similar example is a character that puts his hand on the shoulder of another character
In this case you do the same, you constrain the hand on the shoulder control, so select the shoulder ctrl first, then the wrist ctrl and apply a Parent constraint (Maintaining the Offset)!
Then you animate the blend parent before he touches him, turning the constraint OFF and when he touches the shoulder you set it at 1 turn it ON!
In this way, if you animate the other character, the hand follows the second character movements
-Two Characters holding their hands-
First pose the two hands, then choose the leading hand (this hand can be in IK or FK) and constrain the other hand to this one (the constrained hand must be in IK) and choose a Parent constraint!
An other situation…
Let’s say your character need to grab an object, like this ball, he takes it with an hand (in this case you can us IK or FK) and then he throws it!
So the ball will be driven by the character but at one point it will moves independently
In this simple case, you could just constrain the ball geometry, it’s not necessary to have a locator or a rig for the ball, ’cause the animation is pretty easy. But if you have to do more complex actions with the ball I suggest you to use a locator or a rigged ball so that you could also have a squash and stretch!
So in this example I just constrain the geometry to the hand, as I show in the previous example, I pose the ball in the starting pose, then I pose the hand at the point where it grabs the ball
Select the hand control -> shift -> and select the ball geometry and choose Parent constraint (Maintaining the Offeset)
To switch On and Off the constraint, select the ball geo (or the group, locator or control you constrained) and add a key, set at 1 the blend parent attribute on the frame where the hand touches the ball
in the previous frame set it at 0, so the ball stays in the starting position!
When you need to detached the ball from the hand, go on the last frame where the ball must be constrained to the hand and set at 1 the blend parent, in the following frame set it at 0 and animate the ball!
SECOND OPTION: To have more control and have the possibility to add a secondary movements on the ball, you can create a group for the ball so that you can constrain the group to the hand and animate the ball geometry indipendently!
So we do just as in the previous example but we don’t go to constrain the geometry, but we constrain the group
Open the OUTLINER, select the ball geometry and press G, so you go to create a group and you go to constrain this group to the hand, so select the hand ctrl then the group of the ball and apply a Parent constraint mantaining the offset!
So now the ball follows the hand but you can select the ball geometry (that has no constraint and is free to move) to add further movements! When you want to turn ON and OFF the constraint just do as we have seen so far!
Let’s change the type of prop, let’s say he grabs a bottle
If you create a group from the bottle geometry and you go to constrain the group to the hand, you can still select the bottle geometry to add some overlap!
In this case I also need to move the pivot of the bottle geometry, that now is in the center and I wanted to move it on the top, where the hand grabs it! So to edit the pivot position just select the mesh and pressing D you move it where you want!
Now the bottle is driven by the hand (cause the bottle group is constrained) but we can animate the geometry to add an overlap!
If you have a rig on your prop, you can do the same: create a group that you will constrain to the hand and then you animate the prop control for the overlap!
There’s some situation where you will need to constrain the character to an object
-Character on a Swing-
For example: a character on a swing, obviously this is not a common thing you’ll have to animate, but it’s just to give you an example of situation where your character is driven by something!
You pose your character on the seat, both the arms are in IK, the legs must be in FK, and you constrain the COG of the character to the seat, so that when you move the swing the body follows the movements, except for the hands that are in IK!
So now we need to constrain the hands to the swing’s ropes, to do that we need to create 2 locators!
So we go to CREATE -> LOCATOR
We turn ON the locator visibility from the SHOW panel
We move the locator on the first rope, where we have one of the hands and then with ctrl D we duplicate this locator and we move the second one on the other side
Then, select one rope -> shift -> the first locator and create a Parent constraint, and do the same for the other locator!
Or, another way is to just PARENT the locators to the ropes, so we don’t create a constraint but we create a permant relashionship parent/child between the rope (parent) and the locator (child), to do that: select the locator -> shift -> the rope and press P, and do the same with the other locator and rope!
Let’s quickly see the…
-Difference between PARENT CONSTRAINT and PARENT-
- The PARENT CONSTRAINT is (what we have seen so far) an animatable relationship between 2 (or more) objects that you can control and animate. It can be turn OFF and ON depending on your needs and can be apply on some axes that you can choose between: translation rotation or scale! To create a constraint we select the leading object, then the constrained object, and we apply a Constraint (choosing between POINT, ORIENT or PARENT)
- PARENT is a permanent relationship between a parent and a child that doesn’t changes! The child is subordinate to the parent, no matter what! You can still animate the child independently, but any time you translate, scale or rotate the parent…the child will follows. To parent an object to another, we select the child object first, then the parent object and we press P, in the outliner you’ll see that now you have a hierarchy where the first object selected is child of the second object
In this case the result is the same, so you can choose one of this two options and in both the cases the locators will follow the ropes movements! The only difference would be if you need to change position of the hands on the rope during the animation, in this case is better to choose to just PARENT the locators to the rope, so that you can use the locators (the are not constrained) to animate the hands!
So now the 2 locators follow the swing movements, but we still need to constrained the hands, so we select one locator then the hand control and create a parent constraint and do the same for the other hand!
Or, if the character is trying to lift an heavy object without success… so the object will stays on the ground…
…would be easier for you to constraint the hands on the object
So we create 2 locators, that we keep in on the origin, so we don’t move them, then selecting the 2 locators we create a group pressing G
and we constrain this group to the object, so we select the object and then the locators group and we create a PARENT constraint, so now the locators group is constrained to the object
Now we need to position the locators where we have the hands, to quickly do that we create a temporary constraint!
We go on the frame where the hands touch the object, we select the hand control then one of the locator
and we create a parent constraint but this time we UNCHECK the MAINTAIN OFFSET, so the locator jumps on the wrist pivot (this is a very quick way to position an object on the pivot of another object)
and now we can delete this constraint from the locator, in the channel box we select the constrained axes and -> right-click -> BREAK CONNECTIONS
Then we constrain the hand control to the locator, so select the locator and then the wrist control and create another parent constraint!
From this point you can forget the hand control and use the locator to animate the hand! Do the same for the other locator to pose it on the wrist pivot and then constrain the hand to the locator
In this way when you animate the object, that leads the movement, the hands follow but you can also add some further movements for the hands by using the locators that are free to move ’cause we just constrained the group of the locators!
This is also something very common and I’m going to show you 2 different options for this
The first and faster way is to pose both the hands on the object, constrain the object to one of the hand (the hand you chose as the leading hand, the one that controls the movement) and constrain the other hand to the object, so when you’ll move the leading hand, both the object and the other hand will follow
REMEMBER THAT: the leading hand can be in IK or FK, but the constrained hand must be in IK!
But if you want something more complex, for example if you want to change the positions of the hand while grabbing the object you have to do something similar to what we have done in the example of the heavy object
Creating 2 locators, PARENT the object to one of this locator, so we select the object and the first locator and we press P, and PARENT the second locator to the object
Selecting the parent locator we move the object in position, and then we constrain the parent locator to the leading hand control, (the leading hand can be in FK or IK, but the other hand, that we will be constrained to the object must be in IK)
So we select the leading hand control then the parent locator and we create a parent constrain maintaining the offset
Now we need to position the second locator on the other hand pivot, so we select the hand control -> then the second locator and we create a parent (or point) constrain (DESELECTING the maintain offset), so the locator moves on the wrist pivot, and now we delate this constraint!
Then we select again the locator -> then the left hand control and we do parent constraint again!
So now you can use the right arm to lead the movement, the object and the left arm follow, but using the left locator you can add further movements for the left hand and change position during the animation!
The last situation…
In this case, when you plan to grab the same object with both the hands in different times, it means that the object must be constrained to one hand first and then on the other hand in a second time!
To do that: first let’s set up 2 locators on the object
So we create 2 locators that we rename left and right hand
then we need to PARENT the locators and the object . At this point we should plan which hand holds the object first and based on that we create this parent hierarchy:
- select the locator of the second hand that will holds the object -> then select the locator of the first hand and press P (so now the left hand locator, that is the second hand that holds the object, is child of the locator of the right hand)
- now select the object and the left hand locator and press P (now the object is child of the left hand locator)
So if we move the right hand locator we move everything but if we select the left hand locator we move just he object while the right hand locator stays in position
Now, selecting the parent locator, the right hand locator, we position the object in the right hand (that holds the object first), and then we constraint the parent locator to the right hand control, so we select the hand control -> shift -> the locator and we create a PARENT constrain Maintaining the offset!
Now we can move the arm and the object follows!
When we want to switch the hands, we move on the frame where the object is grabbed by the left hand and we select the left hand control -> shift -> the left hand locator and we create the PARENT constraint Maintaining the offset
then we add a key and we set at 1 the blend parent on this frame but we set it at 0 on the previous frame
Sometimes can happen, for different reasons, that you don’t see the Blend Parent attribute in the channel box
if this happens you can just select the Constraint Node from the Outliner, select the object and in the outliner press F to find the constraint node (the one with the red exclamation mask)
and animate the Weight Value, set it at 1 or 0 to manage the influence of the constraint on the locator!
So now you can pass the object from an hand to another just turning on and off the constrain on the left hand locator!
A similar situation is when the character passes an object, like an hat, from an hand to another and then he puts it on the head
In this case the process is the same but we need to add a third locator, that is the one that will be constrained to the head in the final part
So we start setting the locators on the hat, we create 3 locators, that we rename as the body parts they will be constrained to
and we go to PARENT this locators and the hat with this hierarchy:
- we select the right hand locator then the left hand locator and press P
- select the head locator and the right hand locator and press P
- and last, select the hat geometry then the head locator and press P
So now selecting the parent locator, we position the hat in the left hand and we create a parent constraint (Maintaining the offset) with the hand control
Then we do as in the previous example, we animate the constraint blend parent On and OFF when we switch the hands and we constrain the right hand to the other locator… and the same when the hat is on the head, so that in the final part the hat is constrained to the head and follow the head movements!
This were just some examples of how to manage constraints on maya, there are a lot of different way to do them, it’s really depends on what you need in your scene and it also change depending on the type of rig you have
There are also scripts and tools to automatically create constraints, especially in production, but if you are beginners this should be enough to start to manage props in you animations
When you want to delate a constraint you can select the constrained control (or group or mesh) and in the channel box select all the attribute constrained and right-click BREAK CONNECTIONS
Or… select the object constrained, press F in the outliner to find the constraint node and… delate it!
Or, if you want to take off the constraint but you want to keep the animation… you can BAKE the curve
selecting the object constrained and, in the graph editor, click in CURVES – BAKE CHANNEL
so it will converts the the entire animation in keyframes
and now you can delate the constrain, as I showed before, without losing the animation!
In the last lesson I explained the principle of Secondary Actions and props are a good way to add this actions
So now you know how to manage the constraints and you can create an animation with a secondary action following this exercise to put in practice this principle! 🙂