How do you 'get' specific bones in a character skeleton via script.

Hello! How are you?

I would like to know more about targeting specific bones on a character model via script.

I have a character I am controlling with a dual-stick controller. The right stick walks the character around, while the left stick turns the upper body.

I know I can create a simple 'lookat' script and place it directly on the bone I want to turn (in this case, the first spine bone above the pelvis). However I would like to keep the character controls in a single script, currently located on the root node of the overall character, and simply call out to the correct bone from it.

I am a new programmer so apologies if this is more of a general programming question and not specific to Unity. I still greatly appreciate any help though! Thank you in advance!

Bones are just Transforms in Unity, so all you need to do is create a variable, then drag the correct Game Object onto the variable slot in the Inspector.

var bizzyBone : Transform;

You can then script anything you want with that Transform, and the Skinned Mesh Renderer's vertices that are weighted to that bone will go along for the ride (forward kinematics).

Check out the head look controller

http://unity3d.com/support/resources/unity-extensions/head-look-controller