[Closed] Line between two objects
Hi,
I want to create a line that stays between two objects, it will be used in a character rig to show the directions of pole vectors and such.
So far I’ve used Burnett’s Null object, but I would like to make the rig free from external plugins, and I want to do this using only one object. I have a test function that uses a SplineShape with instanced controllers on each vertex, but it doesn’t work if I parent the objects that the shape gets its controllers from…
Here’s the function I made:
function createLine =
(
startObj = sphere pos:[20,0,0] radius:2
endObj = sphere pos:[0,40,0] radius:2
local tShape = SplineShape pos:[0,0,0]
addNewSpline tShape
addKnot tShape 1 #corner #line startObj.pos
addKnot tShape 1 #corner #line endObj.pos
updateShape tShape
startCon = Point3_XYZ()
endCon = Point3_XYZ()
animateVertex tShape #all
tShape[4][8].controller.Spline_1___Vertex_1.controller = startCon
tShape[4][8].controller.Spline_1___Vertex_2.controller = endCon
startCon[1].controller = startObj.pos.controller[1].controller
startCon[2].controller = startObj.pos.controller[2].controller
startCon[3].controller = startObj.pos.controller[3].controller
)
createLine()
Has anyone here a better suggestion?
Well it is working you are just getting a double transform. Each vertex is moving but so is the transform of the line itself now. Best way to solve this is to multiply the matrix value for the vert by the inverse of the object the line is parented to.
Maybe a scripted manipulator can be used too, if you’re on subs then there’s a series from Bobo explaining the use of custom scripted manipulators.
-Johan
Thanks for the quick replies – I will look into both solutions.
I got the idea to do it this way from Puppetshop, actually. But I am having a hard time digging into Puppetshop to figure out how it is done. Well, well…
Puppetshop has some C++ plugins running things so it might not be done the same.