Repositions a chain element (root, bone, or effector) while fixing all others in space. Connecting bones resize and rotate to fit the new position of the chain element. In branch mode elements after the moved element move together as a group (fixed relative to the moved element), whereas in node mode they are fixed in global space. In bone mode a bone's base and tip move together, otherwise the base and tip move independently.
MoveJoint( InputObjs, X, Y, Z, [MoveJointBranch], [MoveJointBone] ); |
Parameter | Type | Description |
---|---|---|
InputObjs | String |
Skeleton root, bone, effector, or joint property Default Value: Current selection |
X | Double |
New x coordinate Default Value: 0 |
Y | Double |
New y coordinate Default Value: 0 |
Z | Double |
New z coordinate Default Value: 0 |
MoveJointBranch | Boolean |
True if moving the element in branch mode, False for node mode. Default Value: False |
MoveJointBone | Boolean |
Specifies whether to move the element as a bone or a joint.
If FALSE, the bone's base is moved and the tip stays fixed. If TRUE
the bone's bone and tip move together. This parameter is ignored for
roots and effectors.
Default Value: False |
' ' Create a circle with 5 control points. ' Then create a 4 bone chain and move the joints to the control point positions. ' ' ' create the circle ' set oRoot = application.activeproject.activescene.root set oCircle = oRoot.addgeometry("Circle", "NurbsCurve" ) SetValue oCircle&".crvlist.geom.subdivu", 5 ' ' Create a 4 bone chain ' set oChain = oRoot.Add2DChain( Array(-2,0,0),Array(-1,0,0), , si2DChainTop ) for i = 0 to 2 oChain.AddBone(Array(i,0,0)) next ' ' move the joints on the chain to the circle's control points ' set oGeometry = oCircle.activeprimitive.geometry for i=0 to oGeometry.Points.Count - 1 ' get the position of point set oPos = oGeometry.Points(i).position if i < oGeometry.Points.Count - 1 then MoveJoint oChain.Bones(i), oPos.x, oPos.y, oPos.z, False, False else MoveJoint oChain.Effector, oPos.x, oPos.y, oPos.z, False, False end if next ' ' log the positions to show that they are the same ' set oPosP = XSIMath.CreateVector3 set oPosJ = XSIMath.CreateVector3 for i=0 to oGeometry.Points.Count - 1 set oPosP = oGeometry.Points(i).position if i < oGeometry.Points.Count - 1 then oChain.Bones(i).kinematics.global.transform.GetTranslation oPosJ else oChain.Effector.kinematics.global.transform.GetTranslation oPosJ end if logmessage "Point Position: " & oPosP.x & " " & oPosP.y & " " & oPosP.z logmessage "Joint Position: " & oPosJ.x & " " & oPosJ.y & " " & oPosJ.z next ' ' Output from running this script: ' 'INFO : "Point Position: 5.19701675181841 0 0" 'INFO : "Joint Position: 5.19701675181841 0 0" 'INFO : "Point Position: 1.60596649636318 -4.94265664711197 0" 'INFO : "Joint Position: 1.60596649636318 -4.94265664711197 -7.48168305103674E-16" 'INFO : "Point Position: -4.20447487227238 -3.05472980263579 0" 'INFO : "Joint Position: -4.20447487227238 -3.0547298026358 2.95822839457879E-31" 'INFO : "Point Position: -4.20447487227238 3.05472980263579 0" 'INFO : "Joint Position: -4.20447487227238 3.0547298026358 -5.39677520623026E-33" 'INFO : "Point Position: 1.60596649636318 4.94265664711197 0" 'INFO : "Joint Position: 1.60596649636318 4.94265664711198 6.99081284597971E-32" |