Saturday, 29 October 2011

Animation Chronicles - Episode 4: Attribute locking and transform limits

I haven't progressed much since last time as I was too busy playing Forza 4. So far, I've got:
  • A controller for each foot
  • A controller for the hips
  • A "world" controller for the entire character
Now I'll add controllers for the upper body and the head, which will give me the opportunity to talk about attribute locking and transform limits.

For the torso, I went for some sort of harness-like thing. The head got a simple elongated sphere :

The torso controller is constraining the base of the spine as it was the only joint I could use to keep a good looking upper body that doesn't influence leg movement (as they will slightly move if the hip joint moves, because of the IK handles on the leg). Also, I obviously set the controller's pivot to be the constrained joint. Now with this solution, I'll be having trouble making animations where the character's back needs to curve, but I'll worry about that some other day.

For the head controller, I've pondered for a while whether I should use the neck joint or the head joint. Eventually, I decided to go for the head joint, which gives me more possibilities and doesn't create stretching on the character's collar (Note: by doing this, I might actually be working around a poor weighting. And working around bad work is usually a gate to a world of pain near the end of a project. But as I'm doing this for learning purpose, it should be manageable ).

Once all that is done, I've played a bit with the controllers to check everything was okay. I quickly realised that translating the head controller isn't a good idea, and translating the torso controller a terrible one. In order to to avoid any such kind of accidental movement, I'm simply going to lock the translations on the torso controller. To do so, the easiest way is to select the translation attributes in the Channel box, select "Lock Selected" in the right-click menu.

Now, when I select the upper body controller with the translate tool, the axes are grey, and I can't move the controller, which is good. However, the gizmo will turn grey only if all axes are locked (and that is not very clever).

For the head controller, I wanted to try limiting translation and orientation (so I can't stretch the neck). This is done in the attribute editor, as shown below:

Note that the Z Translation limit is extraneous as the axis is locked.
The problem with that thing is that it seems consider world axes rather than local ones. It still works if you do your rotations and translations in local space, but you get near the limits, funky things start happening. I think I'm going to pass on this feature for my controllers, but it's good to know it's there, might be useful when making 2.5D games