FAQ    Search   Memberlist   Usergroups   Register   Profile   Log in to check your private messages   Log in 

Action Constraints tutorial made easy
Post new topicReply to topic
elYsiun.com Forum Index -> Blender Animation
View previous topic :: View next topic  
Duoas
Forum Monkey

Joined: 27 Dec 2004
Posts: 1281
Post subject: Action Constraints tutorial made easy
Post Posted: Tue Aug 23, 2005 6:39 pm
Reply with quote
Action Constraints are a powerful animation feature in Blender. However, I've not come across anything that directly addresses the issue of making and using action constraints. Nozzy's famous rig makes use of them, but it is a fairly advanced setup for the newbie. This tutorial aims to strip out everything but the topic at hand...


Objective

We will tackle animating a spine. Those of you who have tried to do this with IK notice it is very difficult to control that way, and introduces "jumpy" behavior whenever the spine is nearly straight.

Instead, we'll construct our spine without IK solvers and manipulate it with action constraints. This will give exacting control on exactly how the spine bends.


Assemble your mesh, armature, and views

Here is one of those handsome fellas from MakeHuman 1.8, with an elementary rig. I purposefully left the arms off in order to unclutter this tutorial.


I've highlighted here the bones we're interested in. The Sway Spine bone is the one we will use to control the curvature of the spine when we're done. For now, however, we'll ignore it.

Once you're done setting up your armature, assigning weights, etc., switch over to Pose Mode (Ctrl-Tab).


Action Editor

Open up the Action Editor and add a new action block:


One thing to note is that whenever you add a new action it automatically makes a duplicate of the current action. For this, and one other reason we will make note of shortly, let's add another new action.

The action name should now read "Action.001"


Change it to "Sway Spine"

It is not required to have a name matching any bone (or anything else in Blender) --you could have named it "fooey kablooey". My preference is simply to name the actions --and the bones that control them-- as descriptively as possible. For me that means that they'll have the same name.


Adding the first key

Adding an action is just like normal key animation. Since our 'swaying' action is to sway between the left and the right, our central, 'neutral' pose should be somewhere in the middle.

Pressed the Up-Arrow key to move to frame 11. There's nothing special about frame 11, it's just where I'm putting my center key. Select the bones of the spine and press 'I' --> Insert Loc/Rot.


The Action Editor will display the new keys:



Additional Keys

Let's bend the spine right, shall we?
Set the frame to 1 and play with the spine until it's somewhere you like it.



You'll notice that I've kept his head up. All this action is designed to do is curve the spine. Not bend over at the hips. We can use the Spine A bone for that later.

Press 'I' and insert another Loc/Rot.


Next I changed to frame 21 (the last frame in the action), adjusted the spine bones appropriately, and inserted the final key.




You can, of course, use all the normal action editing techniques here to test your frames. Go to frame 1, press Alt-A, and watch him sway from his right to his left. Add, delete, and rearrange keys until you are satisfied with the motion.


The center key

Since this action is centered at frame 11, set the frame number to 11. Now select the "Action" action from the combobox. You can now change the frame number back to 1.



The location of the frame index is important for an action. In most cases, you can leave it at 1. But for an action like this we want it in the middle of the action.

This is the other reason for having an empty Action block from which to build new actions. It just makes life a little easier to not have to worry about those things.


Applying the Action Constraint

Now to make our boy dance.

Select the bone labeled "Spine A" and press F7 to display the Object Buttons. Under the Constraints tab, add an action constraint.



Target
For "Target" type in the name of your armature.
A new box will display. Type in the name of the bone which will control the spine: "Sway Spine".

Action
In the box that says "AC:" type in the name of the action "Sway Spine".

Don't be concerned that the armature deforms in the 3D View. We'll fix that.

Rotation Axis
The degree we rotate our bone around the Z-axis is what controls the action. You can make it any axis you want, or change it later if needed or desired.

Start and End
Our action begins at frame 1 and ends at frame 21.

Min and Max
I like the greatest range of motion possible, so it's 90.00 to -90.00 degrees.



At this point you can grab the Sway Spine bone and rotate it to see what happens. I had initially set my min and max to -90 to 90, which made him sway left when I rotated the bone right. So I swapped them to make it do what I want.

The only thing remaining is to repeat the process of applying the action constraint to Spine B and Spine C. Notice how we never did anything to the Sway Spine bone?

In Blender, constraints are applied to the controlled bone, and target the controller bone.


The Null Constraint
One important thing that should be mentioned here concerns the use of a Null Constraint. In our example each bone of the spine (A, B, and C) has only one Action Constraint applied to it.

However, it is often convenient to apply multiple action constraints to the same bone. The next logical step for our spine would be to create another action called "Bend Spine" which makes the spine curve forward and backward (slouch and stretch, as it were). We would then need two bones to manipulate the spine: "BO:Sway Spine" and "BO:Bend Spine", and two corresponding actions that do each one: "AC:Sway Spine" and "AC:Bend Spine".

Each bone in the spine would then have two Action Constraints applied to it: one targeting the "Bend Spine" bone and action, and one targeting the "Sway Spine" bone and action.

In Blender, if two or more constraints of the same type are applied in sequence, the result is an average of the constraints. This is useful for doing something like constraining an object to track the point between two or more other objects. In the case of Action Constraints, however, the average result is usually undesireable.

To solve the problem, place a Null Constraint between each Action Constraint to prevent them from being averaged together. The result should look something like this:

To move a constraint up or down in the list, collapse it (click the little triangle), and click the name to get a pop-up dialogue to move it up or down.


Using the Action

The only thing left to do is play with the new action constraints.

Since we'll never need to mess with Spine B and Spine C, Tab into edit mode and hide them. Now Ctrl-Tab back to Pose mode. The action editor should read "AC:Action". Good.

Animate as usual. You can rotate the Sway Spine bone left and right to control the entire spine, and rotate the Spine A bone to make him bend at the hips.

Here's my animation doing just that. (DivX 328KB)

I hope this helps. If I've left anything out, or have been unclear, let me know.


Added information about Null Constraints (18 Sep 2005)

_________________
"I've had a few of those the other day, but not today."

The sixth sick sheik's sixth sheep's sick. --tongue twister


Last edited by Duoas on Sun Sep 18, 2005 11:40 pm; edited 1 time in total


Back to top
View user's profile Send private message Send e-mail Visit poster's website
Gabio
Moderator

Joined: 24 Nov 2003
Posts: 1936
Post subject:
Post Posted: Wed Aug 24, 2005 1:08 am
Reply with quote
Nice...
Very detailled tutorial here.
psss, Animation workshop?
I also did a small tut on action constraint here

_________________
A man's got to believe in something. I believe I'll have another drink.
-- W.C. Fields


Back to top
View user's profile Send private message Visit poster's website
melon2005
Forum Newbie

Joined: 23 Jun 2005
Posts: 22
Post subject:
Post Posted: Wed Aug 24, 2005 6:04 am
Reply with quote
Hey, there's never enough nice tutorials! You should somehow link it with Animation Workshop, to keep this kind of valuable information in one place.

Anyway, lot of thanks for this!


Back to top
View user's profile Send private message
Gabio
Moderator

Joined: 24 Nov 2003
Posts: 1936
Post subject:
Post Posted: Wed Aug 24, 2005 2:16 pm
Reply with quote
melon2005 wrote:
Hey, there's never enough nice tutorials! You should somehow link it with Animation Workshop, to keep this kind of valuable information in one place.

Anyway, lot of thanks for this!

yea, keep this near, such tut is worth incorporating in the 2.4 manual.

_________________
A man's got to believe in something. I believe I'll have another drink.
-- W.C. Fields


Back to top
View user's profile Send private message Visit poster's website
Duoas
Forum Monkey

Joined: 27 Dec 2004
Posts: 1281
Post subject:
Post Posted: Wed Aug 24, 2005 3:10 pm
Reply with quote
Wow! Thanks!
_________________
"I've had a few of those the other day, but not today."

The sixth sick sheik's sixth sheep's sick. --tongue twister


Back to top
View user's profile Send private message Send e-mail Visit poster's website
myfish
Donating Member

Joined: 09 Sep 2003
Posts: 21
Post subject:
Post Posted: Wed Aug 24, 2005 5:52 pm
Reply with quote
yes, very informative. Thanks.

As more people like myself become aware of the animation re-code tutorials like this will become worth their weight in gold pixels.

I find alot of tutorials try to do too much, rather than focus on 1 or 2 main tasks. This one was nice and comfortable, without straying.
Thats important.

For those listening, we need more on constraints.
Wait for the new IK code first though.

I might have a go at some simple tuts myself, but i'm not a blender native.
Migrating in from A:M which has a great constraints system, when you are not re-starting the damn thing

Blender is looking more like a new 1 stop shop for animators.

_________________
--
Keith White


Back to top
View user's profile Send private message Send e-mail Visit poster's website
pld
Forum Guru

Joined: 21 Oct 2004
Posts: 390
Post subject:
Post Posted: Wed Aug 24, 2005 8:56 pm
Reply with quote
Duoas, great tut! I don't think I even knew about action constraints really, except for the blurb Gabio put up in the workshop... I can't wait to get home and give this a try!

You know, I never realised that this is how nozzy was using a bone to close and open the hand of his skinny_guy rig... Of course it all makes sense now!

Thanks!

_________________
my Homepage
"Abandoned Places entry"


Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
elYsiun.com Forum Index -> Blender Animation
Post new topic   Reply to topic
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum