View Full Version : Line between two objects

09 September 2009, 01:45 PM

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



Has anyone here a better suggestion?

09 September 2009, 01:56 PM
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.

09 September 2009, 02:01 PM
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.


09 September 2009, 02:22 PM
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... :)

09 September 2009, 02:34 PM
Puppetshop has some C++ plugins running things so it might not be done the same.

09 September 2009, 03:05 PM
Yes, I suspected so. Thanks again!

CGTalk Moderation
09 September 2009, 03:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.