HeadLookController

Author: runevision

Description
This script can be used to make a character look towards a specified point in space, smoothly turning towards it with for example the eyes, head, upper body, or whatever is specified. Multiple ranges of bones can be specified, each with different settings for responsiveness, angle constraints etc.

Usage
Drop this script onto a GameObject; typically the root. In the inspector, set the length of the Segments array and specify the settings for each segment. Optionally a list of joints to not be affected can be specified in the Non Affected Joints array. This is to make certain transforms keep their original orientation even though they are children of transforms specified in one of the segments. For example you can have the upper body bend, but set the joints for the shoulders to not be affected (or to be only affected a little).

There is more information and a demo video at the Unity Blog here: http://blogs.unity3d.com/2009/07/10/just-looking-around/

Troubleshooting
Per default, the character needs to have animations that drive all the bones that the script modifies. If a body part turns or twists around out of control, it might be because there is currently no animation playing that has curves for those bones. In that case, the setting Override Animation can be turned on. This make the affected bones ignore any animation that may be affecting them and instead they are set in each frame to be identical to how they were when the object was instantiated. Normally this is not a good idea to turn on. For example, if an idle animation has a subtle breathing animation of the upper body and head, this would be overridden. However, it can be useful for enabling the use of the Head Look Controller on models that do not have any animation on the affected bones at all.