Create line between objects with controller
Hello
I would like to simplify creation of a line between two picked object.
The created line is parented to the first picked object, add a look at targeted to the second picked object, and the line scale is linked to the distance between the two picked objects.
As usual I can do the beginning, but I can't do the end.... If anybody could help :-)
--------------------
obj1 = pickObject()
obj2 = pickObject rubberBand:obj1.pos
obj1n = obj1.name as string
obj2n = obj2.name as string
new_spline = splineShape ()
addNewSpline new_spline
addKnot new_spline 1 #corner #curve [0,0,0]
addKnot new_spline 1 #corner #curve [1,0,0]
updateshape new_spline
new_spline.pivot =[0,0,0]
new_spline.pos = obj1.pos
new_spline.parent = obj1
lookAtCon=lookAt_Constraint()
lookAtCon.appendTarget obj2 1
--lookAtCon.target_axisFlip=true
rotList=rotation_list()
new_spline.rotation.controller=rotList
rotList.available.controller=lookAtCon
new_spline.rotation.controller.LookAt_Constraint.controller.lookat_vector_length = 0
new_spline.scale.controller = scale_script ()
new_spline.scale.controller.script = "[1, distance " + obj1n + " " + obj2n + ",1]*2"
-------------------
Comments
...
Previous example shows method how to link knots at the center or two nodes.
The next example is similar but this time I used pivot position
bga
Thanks for help Barigazy,
Thanks for help Barigazy, works fine.
I know that I have problem with array, now I know I have problems with controllers...
I finally succeed in what I wanted to do, with an object :
pick the first then the second "controller" then pick an object z up, 1 meter height.
-------------------------------------------
obj1 = pickObject()
obj2 = pickObject rubberBand:obj1.pos
new_spline = pickObject rubberBand:obj2.pos
new_spline.pos = [0,0,0]
obj1n = obj1.name
obj2n = obj2.name
new_spline.pivot =[0,0,0]
new_spline.pos = obj1.pos
new_spline.parent = obj1
lookAtCon=lookAt_Constraint()
lookAtCon.appendTarget obj2 1
lookAtCon.target_axis=2
--lookAtCon.target_axisFlip=true
rotList=rotation_list()
new_spline.rotation.controller=rotList
rotList.available.controller=lookAtCon
new_spline.rotation.controller.LookAt_Constraint.controller.lookat_vector_length = 0
new_spline.scale.controller = scale_script ()
xxx = "($"+ obj2n + ".pos - $" + obj1n + ".pos)"
new_spline.scale.controller.script = "[1,1,length " + xxx + "]"
...
If you need explanation for the tracks take a look marked areas on image below

bga
...
Why don't you try something like this
bga
spline vertex number
Hello,
I would like to know how to find the spline track information. On the image from Barigazy the spline1 vertex number [4][8][2] is showed on track view curve editor. But when I try to find this number, I don't what to do to show it.
Without this number I can't animate the vertices.
Any help?
Thank you
Marcos