I have two objects in my scene, a line called curve1
and a circle called nurbsCircle1
. I want to attach one end of curve1
line to the nurbsCircle1
shape.
So that when I move the circle, one end of curve1
will always move with the circle, with the other side of curve1
always staying put. Something like this example
I have asked this question in other places like HERE but I did not get any answers. The only place that I got an answer from was Reddit but it was entirely in code:
import maya.cmds as mc
c = mc.circle()[0]
l = mc.curve(d=1,p=[(-1,0,0), (0,0,5)], k= (0,1))
cls = mc.cluster(l +'.cv[0]',)[1]
mc.select(c,cls)
mc.pathAnimation()
The code works and I do understand it but I am just switching to Maya and I wanted to understand how to do this with the UI first, then through code. Interestingly enough, the person mentions there are “a hundred ways” to do this.
Could someone share with me one way on how to do this with the UI?
I have been lurking on this site for some time so I thought I would finally join and ask here for help.
Any help would be greatly appreciated!
Here’s a direct answer to your question.
c = cmds.circle()[0]
Create → NURBS Primitives → Circle
myLine = cmds.curve(degree=1, point=[(-1, 0, 0), (0, 0, 5)], knot=(0, 1))
Create a line however you like.
This example line of code creates creates a:
- straight line (degree=1)
- from point (-1, 0, 0) to point (0, 0, 5)
- parameterized from 0 to 1 (knot=(0, 1))
cls = cmds.cluster(myLine + ".cv[0]")[1]
Select cv[0] of the line you just created
- Hold right-click over your line, and drag to “Control Vertex”, then click on the CV you want to control
and put a cluster on it.
- In Rigging mode: Deform → Cluster
cmds.parent("cluster1Handle", "nurbsCircle1")
Here I change things up a bit from the reddit post…
In the outliner, middle-click drag “cluster1Handle” onto “nurbsCircle1”
This makes the cluster a child of the circle.
Now when you drag the circle, it will drag the cluster as well. And the cluster controls cv[0] of the line, so it will move!
And now an indirect answer to your question:
Explaining how to do UI things via text isn’t the easiest thing in the world, and understanding those explanations that we would give isn’t easy either.
So if setting up little rigs like this is something that interests you, YouTube tutorials are a MUCH better place to learn the UI (sorry, I don’t know of any good ones). I’m not trying to steer you away from asking questions at ALL. I’m just saying a UI is something that’s better shown than explained.
And then when you hit another wall, you can always ask another question here!
1 Like
Hey I had a chance to go through your answer in Maya, it works! and whats more I understand it now and change it around to suit my needs.
Thank you for taking the time to answer my question. I really appreciate it.
So if setting up little rigs like this is something that interests you, YouTube tutorials are a MUCH better place to learn the UI (sorry, I don’t know of any good ones). I’m not trying to steer you away from asking questions at ALL. I’m just saying a UI is something that’s better shown than explained.
I hear you. I will do this going forward!