Creating & Snapping Group Pivots to Joints

Creating & Snapping Group Pivots to Joints

johngrivas582
Observer Observer
226 Views
1 Reply
Message 1 of 2

Creating & Snapping Group Pivots to Joints

johngrivas582
Observer
Observer

Im trying to use a loop  to create  group nodes for each finger joint and snap their pivots to the joints. Here is what I have so far. It needs work:

 

FJoints = cmds.ls(“L_R*”, type=“joint”)
for jnt in FJoints:
      joint_position = cmds.xform(jnt, q=True, ws=True, t=True)
      groups = cmds.group( em=True, name=‘null1’ )
      cmds.MatchTransform(groups, joint_position)

0 Likes
227 Views
1 Reply
Reply (1)
Message 2 of 2

jmreinhart
Advisor
Advisor

This code should work for you, assuming your joints have names that start with "L_R..."

 

for jnt in cmds.ls('L_R*', type='joint'):
    grp = cmds.group( em=True, name='null1' )
    cmds.matchTransform(grp,jnt)

 

 

Just so you know for the future you should use the "</>" button when pasting code onto the forum. Just pasting it like normal text can cause the formatting to get messed up.