Object Hierarchy | 関連する C++クラス:StaticKinematicState
StaticKinematicState
StaticKinematicState オブジェクトは、オブジェクトの基本ポーズです。StaticKinematicState
オブジェクトにアクセスするオブジェクトには、X3DObjectとClusterがあります。
StaticKinematicState
オブジェクトは、エンベロープを適用したときやスパインやカーブによりデフォームしたときに作られます。現バージョンでは、1
つのオブジェクトは静止キネマティクス状態を 1 つだけ持つことができます。静止キネマティクス状態は、Envelope
オペレータ、DeformBySpine オペレータ、または DeformByCage
オペレータを適用したときの、オブジェクトのポーズのスナップショットです。静止キネマティクス状態は、Animate|Deform|Envelope
メニューの Set Reference Pose を実行すると変更されます。3
つのオペレータのすべてが同一オブジェクトに適用されるオブジェクトが存在する場合は、それらすべてのオペレータが同一の静止キネマティクス状態を共有します。たとえばlater命令などにおいて、エンベロープの最上位でケージデフォームを実行すると、静止キネマティクス状態はリセットされます。このため、このようなデフォーメーションを追加する場合には、通常はリファレンスポーズ内に置くことが推奨されます。
MoveComponent
オペレータによりクラスタを移動、回転、またはスケーリングすると、クラスタのスタティックキネマティック状態が作られます。静止キネマティクス状態は、クラスタの
MoveComponent オペレータにより適用される変換です。1 つのクラスタ上でコンポーネントを
1回移動させるたびに、静止キネマティクス状態は 1 つ作られます(2
つ作られることもあります)。このため、クラスタを何度も変換すると、1
つのクラスタに複数の静止キネマティクス状態が作られます。リレイティブモードでクラスタを移動させると、クラスタに2
番目の静止キネマティクス状態が作られます。
'=======================================================================================
' This script demonstrates how to get the StaticKinematicState object
' from a cluster. Notice that this object only exists after the cluster
' has been transformed.
'=======================================================================================
' Set up a cluster on a torus
set oRoot = ActiveSceneRoot
set oTorus = oRoot.AddGeometry( "Torus","MeshSurface" )
set oPimple = oTorus.ActivePrimitive.Geometry.AddCluster( _
siVertexCluster, _
"Pimple", _
Array( 0,2,8,10 ) _
)
' Print out position information before moving the cluster
getBasePositionInfo oPimple
' Translate the cluster in X and Z
Translate oPimple, 0, 3.54998625973143, -0.354998625973143, siRelative, siView, siObj, siXYZ
' Print out position information after applying envelope
getBasePositionInfo oPimple
function getBasePositionInfo( in_cluster )
' The cluster will only have it after a MoveComponent
' operator has been applied
if in_cluster.HasStaticKinematicState then
set oBasePose = in_cluster.GetStaticKinematicStates
for each oPose in oBasePose
' Create an SIVector3 math object to hold the translation
set oTranslation = XSIMath.CreateVector3
' Print out the translation information from the base pose
oPose.Transform.GetTranslation oTranslation
logmessage "The StaticKinematicState property position is " _
& "(as X, Y, Z): " & oTranslation.X & ", " _
& oTranslation.Y & ", " & oTranslation.Z
next
else
' Default situation
logmessage "There's no StaticKinematicState property on this object."
end if
end function
'=======================================================================================
' Output of above script is:
'
'INFO : "There's no StaticKinematicState property on this object."
'INFO : "The StaticKinematicState property position is (as X, Y, Z): 0, 0, 0"
'INFO : "The StaticKinematicState property position is (as X, Y, Z): 0, 3.54998625973143, -0.354998625973143"
|
'=======================================================================================
' This script demonstrates how to get the StaticKinematicState object
' from an object. Notice that the StaticKinematicState only exists
' after an envelope or deform operation has been performed on the object.
'=======================================================================================
' Set up a null to envelope
set oRoot = ActiveSceneRoot
set oNull = oRoot.AddPrimitive( "Null","MyNull")
oNull.Kinematics.Global.Parameters( "posy" ).Value = 6.0
' Set up the object to use as an envelope
set oCube = oRoot.AddGeometry( "Cube","MeshSurface" )
' Print out position information before applying envelope
getBasePositionInfo oCube
' Set up the envelope
oCube.ApplyEnvelope oNull
' Print out position information after applying envelope
getBasePositionInfo oCube
function getBasePositionInfo( in_object )
' The object will only have it after an envelope or deform
' operator has been applied
if in_object.HasStaticKinematicState then
set oTranslation = XSIMath.CreateVector3
in_object.GetStaticKinematicState.Transform.GetTranslation oTranslation
logmessage "The StaticKinematicState property position is (as X, Y, Z): " & _
oTranslation.X & ", " & oTranslation.Y & ", " & oTranslation.Z
else
logmessage "There's no StaticKinematicState property on this object."
end if
end function
'=======================================================================================
' Output of above script is:
'
'INFO : "There's no StaticKinematicState property on this object."
'INFO : "The StaticKinematicState property position is (as X, Y, Z): 0, 0, 0"
|