Group Pivot Point Problem

Group Pivot Point Problem

Anonymous
Not applicable
1,146 Views
2 Replies
Message 1 of 3

Group Pivot Point Problem

Anonymous
Not applicable

Hey guys, so here is my problem:

I'm trying to create a code that creates an offset group with a NURBS control for joint structures. The offsetgroup needs to have the same pivot point and XYZ transformations as the selected joint.

 

Problem is, however, the group doesn't seem to want to centre it's pivot point to the joint and instead sets itself to the corner of the NURBS control (see the photo). What I need to know is how to set the offset group so that it's pivot is centered then the same as the joint? Any ideas guys?

Here is the code I'm currently using:

 

import maya.cmds as base


def cubeCtrl():
selection = base.ls(sl=True)
selectionindex = selection[0]
offsetGroup = base.group(em=True, n=str(selectionindex)+"_Offset_Group")

base.parent(offsetGroup, selection)
groupselection = base.ls(sl=True)
base.makeIdentity(r=True, t=True)
newCtrl = base.curve( d=1, p=[(0, 0, 0), (0, 0, 2), (2, 0, 2), (2, 0, 0), (0, 0, 0), (0, 2, 0), (0, 2, 2), (2, 2, 2), (2, 2, 0), (0, 2, 0), (2, 2, 0), (2, 0, 0), (2, 0, 2), (2, 2, 2), (0, 2, 2), (0, 0, 2)] )
base.xform(cp=True)
base.parent(newCtrl, offsetGroup)
base.makeIdentity(t=True, r=True)
base.xform(newCtrl, cp=True)

base.parent(groupselection, world=True)

 

Control_Code_Problem_3.jpg

0 Likes
Accepted solutions (1)
1,147 Views
2 Replies
Replies (2)
Message 2 of 3

mcw0
Advisor
Advisor
Accepted solution

Might I suggest the following:

 

1.  Create your control curve.

2.  Group the control curve to itself and name it your offset group

3.  Delete a parent constraint of your offset group to your joint.

0 Likes
Message 3 of 3

Anonymous
Not applicable

A bit of tweaking but that seems to have done the trick. Added a matchTransform instruction and it's worked 🙂 thanks!

0 Likes