[Closed] dummy relative to vertex
This is related to post http://forums.cgsociety.org/showthread.php?p=5227791#post5227791
I am trying attach a dummy to a vertex in a spline. I need it to inherit all of the position and rotation information. I have tried with spline constraints but that doesn’t work out.
They say this can be done with maxscript but I have no idea where to even start on how to get a specific vertex’s information.
Has anyone ever done this before? Can someone point me in the right starting direction for figuring this out?
I have found that if I use the getKnotPoint call then I can get the position of a vertex.
Does anyone know if you can use this to get the Knot point of a vertex in a modifier on top of a stack…i.e. a edit spline modifier on top of a reactor rope modifier?
Not too sure that you can… I think the spline operations tend to work on the base object, not on the output of the entire modifier stack. You might have to make a copy and convert to that to a SplineShape (or collape the stack), then operate on that instead.
Why did that not work out? Is it because of the dynamic spline?
Some pointer code…
-- get the position of the 2nd knot in the first spline of the selected shape
myPoint = getKnotPoint $ 1 2
[67.1686,20.857,0]
-- find its position on the spline by path (could also get by length)
myPointOnSpline = nearestPathParam $ 1 myPoint steps:10
0.5
-- get the 'direction' of the curve at that point. This doesn't get the 'spin' around that direction (which would hav been equivalent to the 'Bank' option in a path constraint).
-- making sure to use pathTangent, as we got the pathParam. Otherwise, lengthTangent.
myTangentDir = pathTangent $ 1 myPointOnSpline
[-0.250724,-0.968059,0]
-- create a new dummy
myDummy = Dummy()
$Dummy:Dummy01 @ [0.000000,0.000000,0.000000]
-- align position with the knot
myDummy.pos = myPoint
[67.1686,20.857,0]
-- and rotation with the direction of the curve
myDummy.dir = myTangentDir
[-0.250724,-0.968059,0]
Now, as per your second post, you mentioned that you’re using an edit spline. If you are using this at all to insert/remove new knots, then I’m thinking you don’t want to use the knots at all. Just get the pathParam or, better, the lengthParam so that you will always get a consistent position along the spline curve regardless of how many knots are on it.
Most of the above functions are in: “Shape Common Properties, Operators, and Methods”. The others (with a lot of equivalent functions) are in the “SplineShape” topic.
Regarding modifiers, I was just dealing with this recently also. As far as I can tell, all the spline operations happen on the base object. So like ZeBoxx2 said, you need to create a copy and collapse that, or collapse the spline you’re working on.