Lookat with offset


#1

Let say we have a rig like this:

delete objects
fn CreateSpline Points render_thickness:1 wirecolor:white parent: =
(
	spline = splineshape pivot:Points[1] wirecolor:wirecolor render_thickness:render_thickness render_displayRenderMesh:true parent:parent
	addnewSpline spline
	for p in Points do addknot spline 1 #corner #line p
	updateShape spline
	spline
)

ctrl1 = point pos:[2.5,0,5] wirecolor:red size:3
ctrl2 = point pos:[-2.5,0,-5] wirecolor:green size:3

spline1 = CreateSpline #([2.5,0,5],[0,0,5],[0,0,-3]) render_thickness:.5 wirecolor:red parent:ctrl1
spline2 = CreateSpline #([-2.5,0,-5],[0,0,-5],[0,0,3]) render_thickness:1 wirecolor:green parent:ctrl2

What I want is to create lookat for each object to look at each other at any movement. But little cylinder always stay at bigger cylinder. How I can rig this?


#2

That’s 2 bones. No need for any additional IK solver, either.

You should set pivots pointing to each other in start.
And to same “vertical” position. Here you offseting only spline geometry.
If you need offseted points for something else/lather (in hierarchy, not in time) than just “attach” them where you want.

You can set bones to not “Freeze Length” for cylinders sliding and/or you can animate cylinder for clearer tracks…

You can tray “rig” setting your geometry as bones.
Link cyl/splines, open Bone tools and with selected check “Bone on”, set bone (stretch) axis to Z in your case.


#3

Edit:
Not to same “vertical” position but same X,Y pos. - no quotes


#4

#1 red and green pipes should be used with LookAt constraints along their long side direction (needs extra target).
#2 red pipe is a child of the green pipe.
#3 red and green points are used as Upnodes for the tubes’ LookAk constraints respectively.


#6

Your answer is not clear for me, would you please show me an example?


#7

lookat_tubes.max (260 KB)


#8

There’s no point of constraints and rigging if it doesnt helping in manipulation/animation.
Here you have 3 unconnected helpers and that’s harder to animate than no rigging.
This case really doesnt need any rigging, just link cylinders and manipulate in local or parent space.
Tough would be easy to lock all but one axis (Z) on child cylinder for all transforms.

Still here bones have advantage of coded locks and look at constraints so we can manipulate rotation by moving child bones and no keys in those tracks cause they cant move. Well thay can only on one axis if we unfreeze bone length.


#9

I see no point in discussing how useful this or that RIG is. However, it is wrong to believe that the rig I have given above does not make sense. It is quite obvious that without the help of some Constraint controller, you cannot repeat the same fuctionality.

however, if you can back up your statements besides words also with an example, I would be interested to take a look …


#10

Sorry, I think I should explain my question more. This is the device I want to rig:

Forsus appliance is just example of devices that we have. upper part will be mount to upper teeth, lower part will be bind to the lower teeth and it’s mechanic looks like a telescope. The circles are pivot locations, red should be always inside green line. We can use lookat for the line, but it’s pivot has offset from it. So my question in general is how we can have lookat for something while its pivot is far from it. I’m actually looking for pure mathematical solution. Because I want to do it also in Blender and Maya.


#11

If the pivot points will be as in these images and not as in the image of the first post, then the solution may be far easier.

(
	
	delete objects
	
	fn CreateSpline Points render_thickness:1 wirecolor:white parent: =
	(
		spline = splineshape pivot:Points[1] wirecolor:wirecolor render_thickness:render_thickness render_displayRenderMesh:true parent:parent
		addnewSpline spline
		for p in Points do addknot spline 1 #corner #line p
		updateShape spline
		spline
	)

	ctrl1 = point pos:[2.5,0, 5] wirecolor:red   box:on cross:off size:4
	ctrl2 = point pos:[2.5,0,-5] wirecolor:green box:on cross:off size:4
	
	sp1 = CreateSpline #([2.5,0, 5],[0,0, 5],[0,0,-3]) render_thickness:0.5 wirecolor:red   parent:ctrl1
	sp2 = CreateSpline #([2.5,0,-5],[0,0,-5],[0,0, 3]) render_thickness:1.0 wirecolor:green parent:ctrl2
	
	lookat1 = lookat_constraint target_axis:2 target_axisFlip:on viewline_length_abs:off
	lookat1.appendTarget ctrl2 50.0
	lookat2 = lookat_constraint target_axis:2 target_axisFlip:off viewline_length_abs:off
	lookat2.appendTarget ctrl1 50.0
	
	sp1.rotation.controller   = lookat1
	ctrl2.rotation.controller = lookat2
	
)

#12

Actually they are not same as the case you’ve created. Please take a look at this picture:

Size

Lets call them arms, arm lengths are not the same in most of the cases (and may have different angles also)