Can I rotation a bone with a script?

Hey Everyone,

New user here on Unity 4. I have a background with C, Java and Blender3D, so I’ve been working with programming and development tools of all kinds for some time now. I’m initially quite impressed with Unity and I’m hoping to utilize it to eliminate a metric ton of code (particularly around physics, collision and animation).

What I would like to achieve now is bone control via script. As a test case, I just want to click the mouse and send the head rotating around continuously. I can do this fine when I attach the script to the top Parent GameObject, but if I attach the script to the Head “bone” nothing happens.

Looks like there is a great community here. Hope to hear back soon.


When animating bones by code, there’s a couple caveats:

If your animation has no animation data for that bone, you can animate the bone freely and/or combine animations. I know that Blender always exports animation for all bones, whether or not they’re animated. It’s a simple fix to change this in Blender 2.49 (, but if you just want to animate by code, then…

If you animate in LateUpdate instead of Update, you’ll override any animation transforms (since animation happens between Update and LateUpdate).