SIApplyConstraint

カテゴリ

constraint

詳細

1 つのオブジェクトを 1 つ以上のコンストレイント オブジェクトに拘束します。 コンストレイントは、被コンストレイント オブジェクトのキネマティクス プロパティの下にあります。 SIApplyConstraint はコンストレイントのオフセットを直接制御するパラメータを持つという点で、ApplyCns や SIApplyCns とは異なります。 オフセットを補正すると同時にオフセット値を渡すと、オフセット値が補正に優先します。

スクリプト構文

oReturn = SIApplyConstraint( PresetObj, [ConstrainedObj], [ConstrainingObj], [Compensation], [Offset1X], [Offset1Y], [Offset1Z], [Offset2X], [Offset2Y], [Offset2Z] );

戻り値

新しい Constraint オブジェクトを含む XSICollection を戻します。

パラメータ

パラメータ タイプ 詳細
PresetObj 文字列 またはプリセット オブジェクト(「SIGetPreset」を参照) コンストレイントプリセット。

警告: Linux のプリセット名では、大文字と小文字が区別されます。
ConstrainedObj 文字列 拘束されるオブジェクトのリスト

デフォルト値: 選択されたオブジェクト

ConstrainingObj 文字列 コンストレイント オブジェクトのリスト

デフォルト値: 選択されたオブジェクト

Compensation ブール 補正をオンにする場合は True

デフォルト値: False

Offset1X Number X のオフセットの値

指定可能な値:

説明:

RotationOffset(Orientationconstraint)
TargetOffset(Directionconstraint)
ScalingOffset(Scalingconstraint)
ConstrainedObjectAttachPoint(Distance,Position,Surface,Trajectoryconstraints)
Offset1Y Number Y のオフセットの値

指定可能な値:

説明:

RotationOffset(Orientationconstraint)
TargetOffset(Directionconstraint)
ScalingOffset(Scalingconstraint)
ConstrainedObjectAttachPoint(Distance,Position,Surface,Trajectoryconstraints)
Offset1Z Number Z のオフセットの値

指定可能な値:

説明:

RotationOffset(Orientationconstraint)
TargetOffset(Directionconstraint)
ScalingOffset(Scalingconstraint)
ConstrainedObjectAttachPoint(Distance,Position,Trajectory,Surface,Trajectoryconstraints)
Offset2X Number X のオフセットの値

指定可能な値:

説明:

ConstrainingObjectAttachPoint(Distance,Positionconstraints)
Offset2Y Number Y のオフセットの値

指定可能な値:

説明:

ConstrainingObjectAttachPoint(Distance,Positionconstraints)
Offset2Z Number Z のオフセットの値

指定可能な値:

説明:

ConstrainingObjectAttachPoint(Distance,Positionconstraints)

VBScript の例

'
' Orientation constrain two cones to a cube, compensating one of them.
'
dim oCube, oConeCompensated, oConeUncompensated
'
' get a cube and rotate it so we can see how orientation is being constrained.
'
set oCube = GetPrim("Cube")
oCube.length = 2
Scale oCube, 0.5, 3, 0.5, siRelative, siLocal, siObj, siXYZ
Rotate oCube, 45, 0, 45, siRelative, siAdd, siObj, siXYZ
'
' create the two cones and put on either side of the cube
'
set oConeCompensated = GetPrim("Cone")
Translate oConeCompensated, -4, 0, 0, siAbsolute, siParent, siObj, siXYZ
set oConeUncompensated = GetPrim("Cone")
Translate oConeUncompensated, 4, 0, 0, siAbsolute, siParent, siObj, siXYZ 
'
' Apply the constraint
' Offset one cone's orientation by 30 degrees about each axis
'
SIApplyConstraint "Orientation", oConeCompensated, oCube, false, 30,30,30  
SIApplyConstraint "Orientation", oConeUncompensated, oCube, false
'
' display the constraint relationship in the camera view
'
SetValue "Camera.camvis.*constraint*", True
'
' log the constraint offsets to show 
' that one has been compensated
'
dim comp_x,comp_y,comp_z,uncomp_x,uncomp_y,uncomp_z
comp_x = GetValue( oConeCompensated&".kine.oricns.offx")
comp_y = GetValue( oConeCompensated&".kine.oricns.offy")
comp_z = GetValue( oConeCompensated&".kine.oricns.offz")
uncomp_x = GetValue( oConeUncompensated&".kine.oricns.offx")
uncomp_y = GetValue( oConeUncompensated&".kine.oricns.offy")
uncomp_z = GetValue( oConeUncompensated&".kine.oricns.offz") 
logmessage "Compensated cone offsets:   x= " & comp_x   & " y= " & comp_y   & " z= " & comp_z
logmessage "Uncompensated cone offsets: x= " & uncomp_x & " y= " & uncomp_y & " z= " & uncomp_z
'Results of running this script:
'INFO : "Compensated cone offsets:   x= 30 y= 30 z= 30"
'INFO : "Uncompensated cone offsets: x= 0 y= 0 z= 0"

関連項目

SIApplyCns RemoveAllCns RemoveCns