Código:
-Select two points or more points and run the code below for creating a stretchy bone or a stretchy chain.
Fn makenubbone lastbone =
(.
Local pues = lastbone, transform[4] - Get the position of the last bone.
Local xdir = lastbone, transform[1] - Get the Vector of the x point.
Local startpoint = pues + xdir * lastbone, length.
Local endpoint = startpoint + xdir * lastbone.width.
Local nubbone = bonesys, createbone startpoint endpoint lastbone, transform[3] - Create the bone.
Nubbone.width = lastbone.width.
Nubbone, height = lastbone, height.
Nubbone.wirecolor = lastbone.wirecolor.
Nubbone, parent = lastbone.
Nubbone, name = lastbone, name + _nub.
Return nubbone).
Fn pointfilt o = (classof o == point).
If selection, count == 2 do.
If classof selection[1] == point and classof selection[2] == point then.
Thepoints = selection as array.
Thebone = bonesys, createbone thepoints[1], pues thepoints[2], pues thepoints[1].transform[3].
Thenub = makenubbone thebone.
Thebone, position, controller = position_constraint().
Thebone, position, controller, appendtarget thepoints[1] 100.
Thenub, position, controller = position_constraint().
Thenub, position, controller, appendtarget thepoints[2] 100.
Thebone, rotation, controller = lokat_constraint().
Thebone, rotation, controller, appendtarget thepoints[2] 100.
Thebone, rotation, controller, viewline_length_abs = false.
Thebone, rotation, controller, upnode_world = false.
Thebone, rotation, controller, pickupnode = thepoints[1].
Thebone, rotation, controller, upnodeaxis = 2.
Thebone, rotation, controller, estoupaxis = 2).
Else messagebox selected objects must be points).
If selection, count > 2 do.
Thecnts = #().
Thebones = #().
For I = 1 todo (selection, count-1) do.
If classof selection[1] == point and classof selection[2] == point then.
Thepoints = selection as array.
Thecnt = point transform:thepoints[i].transform box:on cross:of axistripod:of size:1.
Thecnt, parent = thepoints[i].
Thebone = bonesys, createbone thepoints[i], pues thepoints[i+1], pues thepoints[i].transform[3].
Append thecnts thecnt.
Append thebones thebone).
Thenub = makenubbone thebones[thebones, count].
Thenubcnt = point transform:thenub, transform box:on cross:of axistripod:of size:2.
Append thebones thenub.
Append thecnts thenubcnt.
Thenub, position, controller = position_constraint().
Thetarget = (pickobject Prompt:enter a point filter:pointfilt).
Thenub, position, controller, appendtarget thecnts[thecnts, count] 100.
For I = 1 todo thebones, count-1 do.
Thebones[i].position, controller = position_constraint().
Thebones[i].position, controller, appendtarget thecnts[i] 100.
Thebones[i].rotation, controller = lokat_constraint().
Thebones[i].rotation, controller, appendtarget thecnts[i+1] 100.
Thebones[i].rotation, controller, viewline_length_abs = false.
Thebones[i].rotation, controller, upnode_world = false.
Thebones[i].rotation, controller, pickupnode = thecnts[i].
Thebones[i].rotation, controller, upnodeaxis = 2.
Thebones[i].rotation, controller, estoupaxis = 2).
For I = 2 todo thebones, count do.
Thebones[i].parent = thebones[i-1]).
).
Else messagebox pléase select two objects.
Selecciona dos o más puntos y ejecútalo.