Code: Select all
def rotBone(name, degree):
bpy.data.armatures["Armature"].bones[name].select = True
bpy.ops.transform.rotate(value=(degree,), axis = (0,1,0))
I am trying to programmatically create a walk or run cycle. If the character, in POSE mode, starts at attention, the above method will, let's say, rotate the arm bone (name="arm_L.001", degree = .7) forward as if to shake hands. Then I can make the right leg step forward as well etc.... But the axis ("y" in this case) seems to be relative to the scene, not to the parent bone ("spine"). If before rotating arm I rotate the spine, then y rotation of arm still follows previous motion, does not adjust for turning of spine, so arm now comes out sideways rather than forward.
Is there a way to specify arm/leg bone rotation relative to the parent bone (spine), so if spine twists the arm movement stays same relative to the spine? Do I have to rotate the scene "z" axis manually after rotating the spine?