I'm looking to give my mesh a run animation where the direction of the legs change depending on the joystick direction.
Let me explain in detail, imagine a thumb stick on a game controller. When the thumb stick is pointed up/forward, I want the character to run forward so the legs should be pointed the same way. Here is an example:
Notice the legs are pointed forward. Now if the thumb stick is pointed to the left, I want the character to run to the left so the legs should be pointed likewise.
The benefit of this is that I only need to make one run/walk animation and I can just rotate the legs to match the direction of the thumb stick. It would give a nice analog visual movement to the legs because they can point towards any direction. Also it's worth noting that when I say they're pointed toward the left, I mean they're pointed toward the left relative to the upper body namely the torso, arms and head. The upper body is rotated with the other thumb stick.
My question is how would I implement something like this?
Here's what my intuition tells me. In my animation software (Blender), I'll animate the player as if he's running forward. Now because I'll have an armature bone hierarchy like the following, if I rotate the pelvis in game using
mesh.skeleton.bones[pelvis].rotation, the legs will rotate as well.
This only works if the key frame data for the bones (position, rotation and scale) is relative to the parent. So would this work? Can I programmatically rotate the pelvis and have the animation for the legs work as expected all with one armature?