Can a Bone's Rotation along a specific Axis drive an animaton


As a rigger, I was just wondering if I can script an interaction in Unity to make a bones rotation run back and forth through an additive animation on that same rig?

i.e. Bone y can rotates 90 deg on its local x axis, which in turn drives a 9 frame animation to play forwards and backwards depending on the bones current rotation.

i.e. Bone y rotates 10 deg and animation x interpolates smoothly between frame 1 and stops on 2.



Edit: I’m not quite sure what you meant by “an additive animation on that same rig”. So sorry if this is too basic / wrong answer.

Hi, yes you can, although I’m not sure about the cost, how taxing it is or not.

You can at least use legacy Animation (not Animator) component, and set it’s animation clip frame.
See: Unity - Scripting API: Animation.Sample

With this knowledge, you could create a script that takes some rotation, normalizes it between values 0-1 and then use that value to drive animation clip, i.e. you sample the animation clip with values between 0-1 (or any range), instead of playing the clip.

So the answer is, you can create systems like Maya Set Driven key or 3ds Max Script Controller animation controller.

Take a look at examples - Some rigger even created full blown auto-rigger in Unity: Puppet3D | Animation Tools | Unity Asset Store

And then there are other neat assets like FinalIK and Puppet Master, which show that you can go far beyond driven keys.



Thanks for the reply, I have seen those assets before, Final IK seems awesome, but just not needed for what I want to create. I too was wondering about the cost of an operation like this, especially If I am using it at a number of different joints.

Its already works great with baked animation, except I need it for dynamic aiming and foot placement, so it has to been driven off of rotations, otherwise, say hello to terrible deformations.

“EDIT” Does a mod want to make this a reply to the other guys answer, whoops.