Line between two objects

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  09 September 2009
Line between two objects


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
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.
Paul Neale
  09 September 2009
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.

Online: LinkedIn
  09 September 2009
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
Puppetshop has some C++ plugins running things so it might not be done the same.
Paul Neale
  09 September 2009
Yes, I suspected so. Thanks again!
  09 September 2009
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:13 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.