
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
Solved! Go to Solution.