チェイン エレメント(ルート、ボーン、またはエフェクタ)を再配置し、その他のエレメントを空間内に固定します。 ボーンに接続すると、チェイン エレメントの新しい位置に合うようにサイズが変更されます。 移動するエレメントに続くエレメントは、ブランチ モードではグループとしてともに動き(移動するエレメントとの相対位置は固定されます)、ノード モードではグローバル空間に固定されます。 ボーン モードでは、ボーンのベースとチップがともに移動します。ベースとチップが独立して動く場合はこの限りではありません。
MoveJoint( InputObjs, X, Y, Z, [MoveJointBranch], [MoveJointBone] ); |
| パラメータ | タイプ | 説明 |
|---|---|---|
| InputObjs | 文字列 |
スケルトンのルート、ボーン、またはジョイントのプロパティ デフォルト値: 現在選択されている値 |
| X | Double |
新しい X 座標 デフォルト値: 0 |
| Y | Double |
新しい Y 座標 デフォルト値: 0 |
| Z | Double |
新しい Z 座標 デフォルト値: 0 |
| MoveJointBranch | Boolean |
エレメントをブランチ モードで動かす場合は True、ノード モードで動かす場合は False デフォルト値: False |
| MoveJointBone | Boolean |
エレメントをボーンとして動かすのか、ジョイントとして動かすのかを指定します。 False を指定すると、ボーンのベースが動き、チップが固定されます。 True を指定すると、ボーンのベースとチップがともに動きます。 ルートおよびエフェクタではこのパラメータは無視されます。
デフォルト値: 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" |