Secondary animation using expressions

This tutorial was written by Matt Lowery. e-mail: mattlowery@mweb.co.za

Many thanks to Patrick Morgan at Avid South Africa for assembling this tutorial



Download Scene file here : Scene and VB Script

Please contact Matt if there are any problems or inconsistencies in this tutorial

Step 1: Open the scene "Start_tutorial.scn" Before going any further, open the Pick_position script in the script editor and make a button for it. We'll use this script later in the tutorial.

This is a simple scene, the head was modeled using face maker that was modified afterward and has a simple envelope deformer added to it.

Scrub through the time line, you'll notice that there is an animation on the character's head but no secoundary animation on the ears. This is what we are going to add in.

Step 2: We are going to use the animation on the circle to create the secondary animation on the ears. It is important to note that the method that we are going to use requires that there be function curves present in order for it to work. So select the circle object and press "0" on the keyboard to bring up the animation editor. You see that the object has rotational animation, but no position animation. If you scrub through the animation you'll notice that the circle is inheriting position from the animation of it's parent. So we need to create an object that has both the rotation and the position changes of the circle object.

Step 3: Get > Primitive >null . Rename the null by pressing enter on the keyboard with the null selected. Rename it, plot_me. Close the property editor.

Step 4: With the new null( plot_me) still selected choose Constrain>Pose and pick the circle around the base of the head. Close the pose constraint property editor . Scrub through the animation and you will notice plot_me now follows the circle.

Step 5: Now, we need function curves for plot_me in order for this effect to work. So choose Plot>All Transformations from the Animate module under Tools.

In the property editor that appears type, use_me, in as the name of the action and make the start frame 1 and the end frame 160. Tick the small box next to " Fit plotted..." and type 0.05 in as the Fit Tolerance setting.see fig.1 (This will reduce the number of keys on the function curves.)


fig.1

Click OK.

Xsi has now made an action clip of the animation of the null. If you open a animation editor for the null you will see that it still has no animation. We need to apply the action we have just plotted, to get the function curves we need.

Step 6:If one is not open already, open an explorer window, and expand the Mixer node just below the Scene_Root by clicking on the "+" next to it. Expand the Sources folder in the same way, and finally expand the Animation folder. There you will see the action called use_me. Hi-light the words "use_me" to select the action,see fig.2 and chose Apply Action from the Animate>Actions menu.


fig.2

Select the null "plot_me" and press the "0" hotkey to open the animation editor. The null now has position, rotation and scaling function curves. (We are not going to use the scaling curves so you can delete them if you wish.)

NB !!! These function curves are going to drive the secondary animation, so if the animation on the circle object was to change, we would need to plot and apply the animation for the plot_me null again in order for the secondary animation to work correctly.

Now we need to create a control null for each joint in the ear.

Step 7:Close the animation editor if it is still open. Choose Get > Primitive >null .

Step 8 : In an explorer right mouse click on "null" and choose Kinematics from the pop up menu.

Step 9: Right click on the green square next to Rotation x under the local transform tab. Choose Expression Editor from the pop up menu.

Step 10: From the menus at the top of the expression editor choose Function>Time>Frame Offset. This adds a line of text to the expression window that looks like fig.3 .


fig.3

 

Remove the brackets from around the Fc-30 and replace the -30 with -1.0 ( The Fc in this expression means current frame, so by typing Fc- 1.0 we are saying take a value from one a frame ago.)

Step 11: Highlight <parameter> in the expression and choose Object from the expression Editors menus, expand the "plot_me" node , expand its kine node, expand local, expand ori, expand euler, and select rotx with the left mouse button.

You should now have an expression that looks like fig.4


 fig.4

Step 12: Click Apply from the expression editor to apply the expression. Or press F5 as the keyboard short cut.

Step 13: Repeat steps 8 to 12 for the roty, rotz, posx, posy and posz of "null" respectively. Be sure to apply the expression to the corresponding parameter on "plot_me". ie. roty on "null" should correspond to roty on "plot_me", posx on "null" should correspond to posx on "plot_me" etc.

Step 14:Once you have applied the expressions to all the parameters close the expression editor and Kinematics property editor if they are still open, and select the object "null" in an explorer. Duplicate it 3 times by pressing "Ctrl d" 3 times. This will creates 3 more nulls all with the same expressions as "null".


 fig.5

Step 15: Right click " null1" in an explorer and chose Kinematics from the pop up menu. Edit the expressions for its rotx, by right clicking on the expression icon fig.5 and choosing expression editor.

Replace the -1.0 in the expression with -2.0. see fig.6.


fig.6.

Do the same for its' roty, rotz, posx,posy,and posz. parameters.

Step 16: Repeat step 15 for "null2" , replacing the -1.0 in all the expressions with -3.0. (Be sure to Apply each expression that you change before moving on to the next one.)

Step 17: Repeat step 15 for "null3" , replacing the -1.0 in all the expressions with -4.0. (Be sure to Apply each expression that you change before moving on to the next one.) Now would be a good time to Save your scene.

Step 18: Multi select the 4 nulls in the explorer and scrub through the time line, you should see the selected nulls lagging behind in the animation. Now we need to set up control rigs for each of the joints in the ears. Start by getting two more nulls, Get>Primitive>null, and duplicate the new null.

Step 19: Rename the two nulls "LCtrl" and "RCtrl" respectively.

Step 20: Make "LCtrl" and "RCtrl" children of "null" by dragging and dropping them onto "null" in the explorer.

 

Step 21: Select "LCtrl", if you haven't done so already make one of the viewports a User view. In that view port, with "LCtrl" still selected, run the Pick_position script and pick the second bone of the chain ( L_ear2 ) inside the left ear. see fig.7


fig.7

This is the equivalent of position constraining "LCtrl" to the bone and then relaxing the constraint.

Step 22: Select "RCtrl", run the Pick_position script and pick the second bone of the chain ( R_ear2 ) inside the right ear.

Step 23: Select the second bone in the right ear chain ( R_ear2 ) and choose Constrain>Position from the Constrain menu, pick "RCtrl" as the object to constrain to. Close the constrain property editor.

Step 24: Select the second bone in the left ear chain ( L_ear2) and choose Constrain>Position from the Constrain menu, pick "LCtrl" as the object to constrain to. Close the constrain property editor. Now scrub through the animation, and see how the ears are starting to lack behind the heads animation.

Step 25: Now we need to create control nulls for the other bones in the ear chains in the same way. Get>Primitive>null, to get a new null, rename it "LCtrl1"

Step 26: Duplicate "LCtrl1" and rename the duplicate "RCtrl1"

Step 27: Make "LCtrl1" and "RCtrl1" the children of "null1" by dragging and dropping them onto "null1" in the explorer.

Step 28: Select "LCtrl1", run the Pick_position script and pick the third bone ( L_ear3 ) in the left ear to move "LCtrl1" to that position.

Step 29: Select "RCtrl1", run the Pick_position script and pick the third bone ( R_ear3 ) in the right ear to move "RCtrl1" to that position.

Step 30: Select the third bone in the right ear chain ( R_ear3 ) and choose Constrain>Position from the Constrain menu, pick "RCtrl1" as the object to constrain to. Close the constrain property editor.

Step 31: Select the third bone in the left ear chain ( L_ear3 ) and choose Constrain>Position from the Constrain menu, pick "LCtrl1" as the object to constrain to. Close the constrain property editor. Scrub through the animation to see how the ears react.

Step 32: Get>Primitive>null, to get a new null, rename it "LCtrl2". Duplicate "LCtrl2" and rename the duplicate "RCtrl2"

Step 33: Make "LCtrl2" and "RCtrl2" the children of "null2" by dragging and dropping them onto "null2" in the explorer.

Step 34: Select "LCtrl2", run the Pick_position script and pick the fourth and last bone ( L_ear4 ) in the left ear to move "LCtrl2" to that position.

Step 35: Select "RCtrl2", run the Pick_position script and pick the fourth and last bone ( R_ear4 ) in the right ear to move "RCtrl2" to that position.

Step 36: Select the fourth and last bone in the right ear chain ( R_ear4 ) and choose Constrain>Position from the Constrain menu, pick "RCtrl2" as the object to constrain to. Close the constrain property editor.

Step 37: Select the fourth and last bone in the left ear chain ( L_ear4 ) and choose Constrain>Position from the Constrain menu, pick "LCtrl2" as the object to constrain to. Close the constrain property editor.

Just the end effectors to go and we will be done.

Step 38: Get>Primitive>null, to get a new null, rename it "LCtrl3". Duplicate "LCtrl3" and rename the duplicate "RCtrl3"

Step 39: Make "LCtrl3" and "RCtrl3" the children of "null3" by dragging and dropping them onto "null3" in the explorer.

Step 40: Select "LCtrl3", run the Pick_position script and pick the end effector of the left ear chain (L_ear_eff) to move "LCtrl3" to that position.

Step 41: Select "RCtrl3", run the Pick_position script and pick the end effector of the right ear chain (R_ear_eff) to move "RCtrl3" to that position.

Step 42: Select the end effector of the right ear chain ( R_ear_eff ) and choose Constrain>Position from the Constrain menu, pick "RCtrl3" as the object to constrain to. Close the constrain property editor.

Step 43: Select the end effector of the left ear chain ( L_ear_eff ) and choose Constrain>Position from the Constrain menu, pick "LCtrl3" as the object to constrain to. Close the constrain property editor.

Scrub through the animation to see how the ears now have full secoundary animation. Feel free to change the animation on the head. Just plot the transformations for "plot_me" and apply the new action, you'll have great secondary animation every time.

The nice thing about this technique is that you can reposition, and even animate the position of the child nulls ( "LCtrl1", "RCtrl1", "LCtrl2", "RCtrl2", etc.) to have the ears point down for example, and the secondary animation will still work.

Regards,

Matt.

e-mail: mattlowery@mweb.co.za

Many thanks to Patrick Morgan at Avid South Africa for assembling this tutorial. Thanks Pat !!!