Hey guys
Right, I'm trying to create a square from a CV curve in python for use as a control object on a joint, but everytime I spawn it the curve ends up like this. I'm creating the curve as a variable, how do I centre the pivot for the curve? Or is there another method to create a curve for it?
newCtrl = cmds.curve(d=1, p=[(0,0,0), (4,0,0), (4,0,4), (0,0,4), (0,0,0)])
base.parent(newCtrl, offsetGroup)
The problem illustrated on a joint.
Thanks
Solved! Go to Solution.
Solved by olarn. Go to Solution.
Using the "xform" command was my first solution, but that doesn't seem to work with the variable. Either putting the xform command next to or after the curve command:
newCtrl = cmds.curve(d=1, p=[(0,0,0), (4,0,0), (4,0,4), (0,0,4), (0,0,0)]), base.xform(cp=True)
base.parent(newCtrl, offsetGroup)
newCtrl = cmds.curve(d=1, p=[(0,0,0), (4,0,0), (4,0,4), (0,0,4), (0,0,0)])
base.xform(newCtrl, cp=True)
base.parent(newCtrl, offsetGroup)
Neither of these methods work, is there another way?
Thanks
import maya.cmds as cmds
offsetGroup = cmds.ls(sl=1)
newCtrl = cmds.curve(d=1, p=[(0,0,0), (4,0,0), (4,0,4), (0,0,4), (0,0,0)])
cmds.xform(newCtrl, cp=True)
cmds.delete(cmds.pointConstraint(offsetGroup, newCtrl))
cmds.parent(newCtrl, offsetGroup)
I'm assuming you have the joint selected.
This is a step in the right direction, it produces this result:
Now the axis just need to align with the joints and it's all good to go. Any ideas?
Sure...in your original "curve" command, rearrange your values so that the curve is created in the correct orientation. You are currently creating your curve on the XZ plane. Try YZ or XY.
You could try commands like
matchTransform -rotation
To match rotation. And then rotate, or just create your curve in the orientation matching your joint's in the first place
Can't find what you're looking for? Ask the community or share your knowledge.