Object Hierarchy | Related C++ Class: StaticKinematicState
StaticKinematicState
The StaticKinematicState object represents the base pose of an
object. Objects that have access to the StaticKinematicState object
include: X3DObject and Cluster.
The static kinematic state on objects is created when applying
envelopes, deform by spine or deform by curve. Currently an object
can only have one static kinematic state. It represents a snapshot
of the pose of the object when the Envelope, DeformBySpine or
DeformByCage operator was applied. It is also changed when doing
Set Reference Pose in the Animate|Deform|Envelope menu. If an
object has all 3 operations applied on the same object they will
all share the same static kinematic state. When doing a cage deform
on top of a envelope for example the later operation will reset the
static kinematic state. This means that it's usually better to be
in the reference pose when adding these deforms (reset
actor).
The static kinematic state on clusters is created when the cluster
is translated, rotated or scaled by the MoveComponent operator. The
static kinematic state is the transformation applied by the
MoveComponent operator on the cluster. There is one or possibly two
static kine state per move component on a cluster. Therefore you
end-up with multiple static kine states on a cluster if you
transform the cluster many times. The second static kine state on
the cluster is created when moving clusters in relative mode.
'======================================================================================= ' 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" |