|
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!
(comments are locked)
|
|
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). Thank you very much!
Jun 15 '10 at 03:07 PM
artician
(comments are locked)
|
|
Check out the head look controller http://unity3d.com/support/resources/unity-extensions/head-look-controller I did! It's in C#! Is there a Java Script equivalent? I don't feel like it's a good idea to switch languages when I'm just getting the hang of the first one... I've compared the two and I'm unable to parse the latter. :( Thank you though!
Jun 15 '10 at 12:38 AM
artician
(comments are locked)
|
