Setting up Actions
You can continue with the figure you established in the previous chapter or you can open the Bruno file by clicking on the following icon:
CMotion consists mainly of Actions. They define how an object behaves within a cyclical movement and which type of behavior is used. Actions control the position and rotation of an object but can also be used to control User Data, parameters and other elements.
Let’s begin with the legs. Select the CMotion object and select the target object L_IK_Leg_nb_con+ object from its object list (this is the controller object for the left leg’s IK). By default, this object already has the Lift (P.Y) Action assigned to it and Driver is set to Steps. The Steps mode moves the controller back and forth to simulate a step movement (this movement is defined automatically by the Stride and Time parameters) and the Lift (P.Y) lifts the foot during the forward motion (its position’s Y value varies according to a Spline curve). You will notice that this lifting is a little weak, so select the Action and increase the Stride value to 50cm so the foot is lifted higher.
Next, we will adjust the foot’s orientation during the animation. If you observe how a person walks you will notice that the heel of the foot is raised when it’s behind the person. When in the air, the foot itself is at a right angle to the shin bones (tibia and fibula). Hence, you must rotate the foot in order to align it properly to the shin bones. This behavior can be created by rotating the IK controller itself but because the Advanced Biped rig is equipped with several foot controllers, these will be used here as well. Therefore, instead of defining a rotation we will simply use the User Data that were prepared for the rig. If you select the left leg’s IK controller in the Attribute Manager you will see the Heel and Ball parameters in the Controllers menu. We will use these parameters to control the orientation of the feet. We could also use the Foot Roll but the other two parameters offer more flexibility for animating. Now select the L_IK_Leg_nb_con+ CMotion controller again in the object list and open the Action menu. This list contains all user-defined controllers that are connected to objects in the object list. Select the Heel Action and click on the Add button to add this action to the leg’s IK controller. Repeat this process with the Ball Action.
Now we will define the Heel value for the walk cycle. This value controls how the foot rolls over the heel. As soon as you select the Action, its parameters will appear below the object list. First, set the Heel value to 100% (otherwise the effect won’t be enabled) so the Heel value can be adjusted via various key positions using a Spline curve. In this case, the Spline matches the elapsing time of the walk cycle.
Once the value for Heel is set to 100%, the Spline will multiply its value between -1 and 1, which means that each point at 1 will result in a Heel value of 100%. A point value of -1 will in turn result in a Heel value of -100%. If the Timeslider is at frame 0, the foot will currently be fully stretched. This means that the value of 100% needs to be corrected (since the Spline has a default value of 1. Right-click on the graph and activate the Link End Tangents and Link End Positions options. This will align the points and the tangents of the Spline ends to create a soft transition between cycles.
Open the spline graph’s options and set the Point Y value to 0. This will control the spline point’s vertical value. Because both points lie at an end and were connected, both points will also be set to 0 simultaneously. By assigning this standardized orientation we ensure that the rotation around the heel is correctly oriented and lets us concentrate on the location at which the foot should actually rotate.
Repeat these steps for the Ball Action object. You can also select both parameters in the object list, which will display both objects’ options at the same time in the Attribute Manager. This makes it easier to compare values for different actions. At frame 0, the left foot is at its rear position so the heel should be raised slightly. Select the Ball Action (this User Data controls the rotation of the ball of the foot), Ctrl+click on the Spline near the green vertical line to add another point. This line represents the Timeline and shows exactly the position influenced by the Spline in the current animation frame. Set the Point X value to 0.25, Shift (to restrict the movement vertically) +click+drag the point upwards until you are satisfied with the result. In this case, a value of 45 should suffice (switch to the side view to get a better view of the orientation of the foot).
Set the Timeline to frame 5, where the ball of the foot should again have its default orientation, and add another point to the spline graph. You do not have to select the Spline exactly but at least be close. At this location, the Ball value should reach 0 because the Action should no longer affect the foot. Set the Point Y value to 0. You will see that the spline curve after this point sinks a little below zero, which means that the ball of the foot will rotate slightly when it moves in the opposite direction. To remedy this, select the current point and set its Interpolation to Linear.
If you move the Timeslider you will see that the Ball of the foot starts to rotate too early when the foot moves downward. Hence, the Spline point must be moved slightly to the rear so the rotation starts a little later. Move the Timeslider to frame 24 and drag the point to frame 24. Press the
Play the animation to test the movement cycle and optimize the Spline points by adjusting their position until you are satisfied with the result.
Now that we have finished adjusting the balls of the feet we will turn our attention to the heels. Select the Heel Action in the Object Manager and move the Timeslider back to frame 0. The ball of the foot does not have to be rotated at this frame - all you have to do is add a point to the Spline graph near the current position. Go to frame 8 (the point at which the foot is farthest from the floor) and add a point so the foot lies at a right angle to the shin. A value of 0.5 for Point Y should offer a good result. Next, add a Spline point at frame 12, where the foot should point slightly upwards. Add a point with a value of -0.5 for Point Y so the tip of the foot points slightly upwards.
If you play the animation now you will notice 2 things: first, the foot starts to rotate a little too early (beginning at frame 0), which causes the foot to penetrate the floor slightly. Then, when the foot approaches the floor again, the toes lower too slowly instead of rising faster (as soon as the heel has touched the floor, the toes should follow quickly. To solve this problem, the second Spline point must be moved slightly, which will delay the rotation of the heel. Then we just have to shorten the time the toes take to point upwards. To do so, duplicate the 4th Spline point and move it a couple of frames and drag the last Spline point forwards slightly so the toes quickly touch the floor again.
Now that our foot moves correctly we can transfer this movement to the right foot. To do so you can either copy the right foot’s Action or use the Reference Action, which references other Actions, similar to the way Instances reference geometry. This is a great way to apply similar behavior to two different objects. Changes to one Action will automatically be transferred to the other Action. Select the object R_IK_Leg_nb_con+ in the Object Manager and add a second Reference Action. Then select one of the Actions, open its selection menu and select the Heel Action. Repeat this with the second Reference and select the Ball Action.
If you play the animation now you will se that both feet have similar motions and changes made to the left foot are transferred to the right foot. You can also replace the right foot’s Lift Action with a Reference to the left foot. Note that the referencing of Actions results in an identical movement being transferred, which can result in a robotic motion in some cases.
Hip and Pelvis Action
Now the feet are done and we can get started with the pelvic area. The movement of the pelvis is quite complex. It sways and rotates to compensate for the movement of the legs and to maintain the body’s balance. Select the object Torso_con+ and add the Actions Twist (R.Z), Roll (R.Y) and Shift (P.X). These will twist, roll and shift the pelvis from side to side, which will simulate the natural movement of the body when it balances during walking. We will keep the default curves but will adjust their values so they match the movement of the feet. Set the Twist (R.Z) and the Roll (R.Y) values to 2° and 10°, respectively and set Shift (P.X) to 2cm. Now stand up, place your hands on your hips and walk through the room. You will notice that your left hip moves forwards as your left leg moves forwards, i.e., the hip is pulled by the leg. This reflects the Twist Action. The right leg stays on the floor, which means your entire wight rests on the right side and your right hip is pushed upwards (reflected by the Roll Action) and slightly to the right (Shift Action).
Head and Body Action
The pelvis now moves as we want it but the upper body now moves unrealistically. The upper body should move in accordance with the pelvis and the spine should be straight in the center. Because IK controls the movement of the spine we have to animate the controller object at the tip of the chain. This is done by the Chest_con+ object. Select this object and assign a Twist (R.Y) and a Roll (R.Z) Action to it. The Twist keeps the spine and head straight while the pelvis rotates. A value that opposes the movement of the pelvis is also needed so set the Twist (R.Y) value to -5°. The movement of the shoulders also need an opposing movement, which is done via the Roll Action. Each time a leg moves forward, the opposing arm will also move forward and this movement comes from the chest across the shoulders. Set the Roll (R.Z) value to 15°. In the image below you can see how the shoulders and chest are angled in order to offset the pelvic movement.
Once these values have been defined you will see that the character moves correctly but that his timing is off. This can be adjusted using the Phase value that can offset an object’s entire animation cycle. Previously in this tutorial we mentioned that this offsetting can be useful when adjusting the movement of hands and feet but can also be useful for other body parts because different movements of various similar body parts move slightly offset between individual cycles. This way, many basic principles of animation such as overshoot, overlapping, follow-through, anticipation and secondary motion can be created.
The chest uses the same timing as the strides so the shoulders and arms have a uniform movement (remember that the arms balance the movement of the opposing arm). Set the Phase value to 25% and play the animation to see if you are satisfied with the character’s movement. Don’t hesitate to modify the values to achieve the movement you want! You are the artist and you decide how your character should move!
Once the chest moves as we want it to we can start animating the head. Select the Head_con+ controller and set its Phase value to 30%. This offsets the head’s movement slightly compared to the chest and shoulders. Since the head is large and heavy it tends to absorb the impact of the legs on the ground with a corresponding movement. This is why we will add the Twist (R.Y), Roll (R.Z) and Shift (P.X) Actions. The head twists to compensate for the twist of the shoulders (normally we keep our head straight when we walk). The roll compensates for the side-to-side movement of the hips and the shift compensates for the impact of the steps.
The following settings can be used for the head’s Actions:
In this case, the curves were also modified to correctly adjust the Actions. The Twist Action remains unmodified but points were added to the Pitch Action to better match the stride movement, and the Roll Action was softened a little so the head won’t bounce too much. The Pitch was given three additional points with values of 0.25, 0.5 and 0.75, respectively. This rotates the head along the curve in such a manner that it points slightly downward at -5° and rotates upwards to 5° in the course of a stride and so on. This movement repeats cyclically. Since the Phase setting controls the offset of the entire animation you do not have to make sure that the cycles repeat identically - you only have to adapt the general movement to best match your character. As long as the points lie at the correct positions on the Spline the animation will be repeated correctly.
The curve for the Roll Action has been softened a little in order to reduce the undulations that occur with the default curve. If you remove the middle point the curve for point 2 will be smoothed. Select the 1st, 3rd and 4th points and set their Interpolation to Spline so you can modify their tangents. Right-click on the graph and enable the Link End Tangents. This ensures that start and end tangents build a uniform curve, even if you only modify one end of the tangent. The other end will automatically be adjusted accordingly. Now select the first point and orient its tangent to an upward angle to create a smooth curve. It is often easier to make these adjustments more accurately if you play the animation while making them since you can see the result of your modifications right away.
Now we will turn our attention to the animation of the arms. Since we have disabled IK we will animate them in FK mode. First, select the upper arm object L_FK_Shoulder_con+ from the Object Manager and add a Twist (R.Y) Action to the arm. This will control the orientation of the arm and lower it further in the direction of the body. Set the Twist (R.Y) value to -45° and delete the middle spline point. Now select both remaining points and drag them to Point Y -1. This will orient the arm downward. You could have also selected an opposite values, i.e., a Twist (R.Y) value of 45° and the spline points at 1. It is only important that the arm is rotated 45° around the Y axis, regardless of how it’s done.
Multiple Actions of the same name can be assigned to an object. You can, for example, assign an additional Twist Action to a shoulder and control this movement separately, without losing the original 45° twist. This can be compared to working with animation layers. Next, we will create a back and forth movement for the arm, similar to the movement of a pendulum. This movement also helps us maintain our body’s balance when walking. Add a Pitch (R.X) Action to the shoulder, set its value to -20 and adjust the curve, as shown in the image below (the default curve is flat and has only two points).
With this curve, the arm will swing 20° to the rear at the beginning of the cycle, 20° to the front at the cycle’s mid-point and then back to its starting position at the end. Subsequently, we have to adjust the timing. The upper arm should react a little later than the rotation of the chest. Phase value of -45 is a good value for achieving this.
Next, select the L_FK_Elbow_con+ object and add a Pitch (R.X) Action. Since an elbow only rotates forwards, no additional Actions will be required. Set the Pitch Action’s value to -20 to make the lower arm swing farther forward and adjust the spline as shown in the image below.
As we can see, the same curve as with the upper arm is used to move the elbow 20° at the mid-point of the cycle. The only minor difference is that the points at the ends of the spline have a value of 0.2 on the Y axis. This Action bends the elbow slightly, as occurs when a person walks (keeping the arms straight when walking requires more effort). Next, we have to adjust the timing, which can be assumed by the shoulders in this case, though somewhat offset. To do so, set the Phase value to -50% (the shoulder uses -45%, which means that the movement of the elbow will end shortly thereafter).
To adjust the movement of the wrist, select the L_FK_Wrist_con+ object and add a Roll (R.Z) and a Twist (R.Y) Action. The twist will define the back and forth movement of the hand and the roll will define the wrist’s rotation. Se the Pitch value to -20 and the Roll value to 20. How does one know which values should be used and that Roll and Twist are the correct Actions to use? If you observe a typical walk cycle you will see that the hands to not actively move. Their movement is a result of the movement of the elbow. The elbow rotates, causing the lower arm to swing, which in turn causes the wrist to rotate around its own axis. In the end, it is up to you to decide the degree to which the values influence the movement but the default values work well for this tutorial. Since the hands are located at the end of this "chain of events", their movement should take place somewhat more offset. Set the Phase value to -70.
Take a look at the image above. You will see that only the Roll Action’s middle point has been removed in order to smooth the curve a little and the rest of the curve maintains its default shape.
In the image below you can see how this correlates to the hand’s Roll Action. If the arm hangs downward, the palm of the hand points toward the body, if the arm is raised, the palm sinks and points downward.
We could again select the Reference Action to transfer the movement of the left arm to the right but this would not work correctly in this case because the values are opposite. Because identical User Data was used for both legs, transferring the movement was not a problem using Reference. Therefore, select all Actions for the L_FK_Shoulder_con+ object, right-click on the objects list and copy these. Now select the R_FK_Shoulder_con+ object, right-click and paste the Actions.
Now make the rotation values of both Actions negative to equal the Twist and Pitch values. Finally, select the R_FK_Shoulder_con+ object again (the right shoulder’s controller) and set its Phase value to 45% (the opposite value of the left shoulder’s controller) so the movement takes place in the opposite direction of that of the left arm.
Next, copy the Pitch Action from the L_FK_Elbow_con+ object (the left elbow’s FK controller) and add it to the R_FK_Elbow_con+ object (the right elbow’s FK controller). Set its Phase value to 50% - the opposite of the left elbow’s value. Here we can’t just enter negative values because the elbow would bend to the rear, which is not a natural behavior. Therefore, we will invert the spline curve to modify the timing of the rotation. The values will then bend the elbow both at the start and end of the movement by -20° and the arm will be straight at the cycle’s mid-point. This results in the opposite movement of the right elbow. Right-click on the spline graph and select Flip command to flip the entire spline curve of the right elbow. Now play the animation and you will see that the right elbow bends forward when the arm rotates forward. If we had not flipped the spline curve the elbow would bend when the arm rotates to the rear.
Finally, repeat the copy procedure for the L_FK_Wrist_con+ object’s Actions (the left wrist’s controller) and add them to the R_FK_Wrist_con+ object (the right wrist’s controller). In this case, the values for Roll, Twist and Phase can be inverted.
Your walk cycle should look pretty good by now and you should feel free to fine-tune it or experiment as you like, or you can let your character walk along a Spline or surface. Click here to see the result of this tutorial:
In this file, the fingers have also been rotated for a more realistic posture - fingers are never straight when just walking along. This was done using the hand component’s sliders, which are located in the User Data’s Controls menu.
You should now be familiar with the basic functions of CMotion and also be able to create your own walk cycles or other character animations using the available templates.