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!
asked Jun 14 '10 at 08:44 PM
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.
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).
answered Jun 15 '10 at 01:37 AM
Check out the head look controller
answered Jun 14 '10 at 10:56 PM