Hi,
I’m a little outside of my comfort zone here, so I’m leaning on you guys for some help.
I’m in the middle of creating an auto IK/FK arm setup, and I need to duplicate or recreate joints for both the IK and FK chains from the deformation rig (export rig). The deformation rig may have helper bones (twist /roll/cloth bones) at a later date so I don’t want to just duplicate this hierarchy.
So my approach so far is this.
[ol]
[li]Get the joints I need to recreate in order; shoulder, elbow and wrist[/li][li]Get the worldSpace translations and joint orientations.[/li][li]Use these to create a new joint chain[/li][/ol]
There’s two errors I get;
[ul]
[li]The translations suffer from (possibly?) precision errors[/li][li]The joint orientations and LRA’s are wrong, even though the values are identical.[/li][/ul]
Can anyone suggest either what I’m missing, or maybe a better way to achieve what I need?
Here’s what I’m basically doing…
import maya.cmds as mc
def copyJointChain(prefix = 'IKRig_',joints=[]):
if not joints:
#joints should be selected in order; shoulder, elbow, wrist
joints = mc.ls(selection=True, type='joint')
mc.select(clear=True)
for joint in joints:
pos=mc.xform(joint, query=True, translation=True, worldSpace=True)
jointOrientation = mc.joint(joint, query=True, orientation=True)
newJoint = mc.joint(name=prefix+joint, p=pos, orientation = jointOrientation)
Next line of attack will be duplicating, then deleting any deformation joints I don’t need. This should work but seems a bit hacky.
Thanks
Paul