need ops.transform.rotate for arm bone relative to spine
Posted: Tue Oct 16, 2012 7:39 pm
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.
Code: Select all
def rotBone(name, degree): bpy.ops.object.mode_set(mode="POSE") bpy.ops.pose.select_all(action="DESELECT") bpy.data.armatures["Armature"].bones[name].select = True bpy.ops.transform.rotate(value=(degree,), axis = (0,1,0)) bpy.ops.pose.select_all(action="DESELECT")
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?