Page 1 of 1

need ops.transform.rotate for arm bone relative to spine

Posted: Tue Oct 16, 2012 7:39 pm
by wretch1958

Code: Select all

def rotBone(name, degree):
	bpy.ops.pose.select_all(action="DESELECT")["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?

Posted: Tue Oct 30, 2012 3:16 pm
by CoDEmanX
not sure if this is what you mean:

- select the arm/leg bone in posemode
- go to Bone tab, untick "Inherit Rotation"
- rotate spine, arm/leg bone will keep it's orientation (like a vector), but changes it's location

Posted: Tue Oct 30, 2012 3:28 pm
by CoDEmanX
just realized, that you may not enable it afterwards again, even if you keyframed poses, it will change

you may look into Constraints