KinematicState

Object Hierarchy | Related C++ Class: KinematicState

Inheritance

SIObject

Parameter

KinematicState

Description

The KinematicState object represents the current pose of a X3DObject object whereas the base pose of an object is represented by the StaticKinematicState property.

The transformation state of the KinematicState object is accessible both through the KinematicState.Transform property and through its ParameterCollection. Both expose the same transformation data, but the KinematicState.Transform is convenient for mathematical manipulation (see XSIMath), while the ParameterCollection exposes the transform as it is shown on the KinematicState property page.

Methods

AddCustomOp AddExpression AddFCurve AddFCurve2
AddScriptedOp AddScriptedOpFromFile AnimatedParameters Connect
ConnectFromFile ConnectFromFile2 ConnectFromPreset ConnectFromPreset2
ConnectFromProgID ConnectFromProgID2 Disconnect Enable operator
GetInstanceValue GetTransform2 operator GetValue2 operator IsAnimated
IsClassOf operator IsEqualTo operator IsLocked operator IsSupportedInstanceValue
PutTransform2 operator PutValue2 operator SetCapabilityFlag operator SetInstanceValue
SetLock Show operator UnSetLock  
       

Properties

Animatable operator Application Capabilities operator Categories
Default operator Description operator FullName operator HasInstanceValue
Help Keyable operator LockLevel operator LockType operator
Marked Max operator Min operator Model
Name operator NestedObjects Origin OriginPath
OriginalValue operator OverridenObject OverridingObject Parameters operator
Parent Parent3DObject ReadOnly operator ScriptName operator
Source Sources SuggestedMax operator SuggestedMin operator
Tags operator Transform operator Type operator Value operator
ValueType operator      
       

Examples

1. JScript Example

/*
        Example of using the SITransformation to read the local
        and global transforms of an object
*/
NewScene(null,false) ;
var oNull = Application.ActiveSceneRoot.AddNull( "ParentNull" ) ;
//Change the position and rotation of the null
//by providing a new transform
oNewLocalTransform = XSIMath.CreateTransform() ;
// Change posx, posy
oNewLocalTransform.SetTranslationFromValues( 10, 20, 0 ) ;
// set rotx to 90 degrees (pi/2 radians)
oNewLocalTransform.SetRotationFromXYZAnglesValues( XSIMath.pi / 2, 0, 0 ) ; 
oNull.Kinematics.Local.Transform = oNewLocalTransform ;
PrintLocalGlobalTransforms( oNull ) ;
var oNullChild = oNull.AddNull( "ChildNull" ) ;
PrintLocalGlobalTransforms( oNullChild ) ;
// Show but the local and global SRT of an object
function PrintLocalGlobalTransforms( in_obj )
{
        Application.LogMessage( "--------" + in_obj.Name + "---------" ) ;
        var oLocalSITranformation = in_obj.Kinematics.Local.Transform ;
        Application.LogMessage( "Local Transform" ) ;
        PrintTransformation( oLocalSITranformation ) ;
        Application.LogMessage( "" ) ;
        Application.LogMessage( "Global Transform" ) ;
        var oGlobalSITranformation = in_obj.Kinematics.Global.Transform ;
        PrintTransformation( oGlobalSITranformation ) ;
        Application.LogMessage( "" ) ;  
}
// Show the "SRT: of a SITransformation object
function PrintTransformation( in_oTransform )
{
        var oVector = XSIMath.CreateVector3();
        in_oTransform.GetScaling( oVector ) ;
        PrintVector( "Scaling:", oVector ) ;
        // In Radians
        in_oTransform.GetRotationXYZAngles( oVector ) ;
        PrintVector( "Rotation:", oVector ) ;
        in_oTransform.GetTranslation( oVector ) ;
        PrintVector( "Translation:", oVector ) ;
}
// Print a vector.  Values are rounded to 3 decimal places
function PrintVector( in_Prefix, in_oVec )
{
        Application.LogMessage( in_Prefix + " " + 
                        XSIRound(in_oVec.x,3) + ", " + 
                        XSIRound(in_oVec.y,3) + ", " + 
                        XSIRound(in_oVec.z,3) ) ;
}
//Output: (note how the local transform of
//the Child null is relative to the center 
//of the parent null)
//
//INFO : --------ParentNull---------
//INFO : Local Transform
//INFO : Scaling: 1, 1, 1
//INFO : Rotation: 1.571, 0, 0
//INFO : Translation: 10, 20, 0
//INFO : 
//INFO : Global Transform
//INFO : Scaling: 1, 1, 1
//INFO : Rotation: 1.571, 0, 0
//INFO : Translation: 10, 20, 0
//INFO : 
//INFO : --------ChildNull---------
//INFO : Local Transform
//INFO : Scaling: 1, 1, 1
//INFO : Rotation: -1.571, 0, 0
//INFO : Translation: -10, 0, 20
//INFO : 
//INFO : Global Transform
//INFO : Scaling: 1, 1, 1
//INFO : Rotation: 0, 0, 0
//INFO : Translation: 0, 0, 0

2. JScript Example

/*
        Example of using the ParameterCollection of
        a KinematicState object
*/
var oNull = ActiveSceneRoot.AddNull( "Null" ) ;
// The transform can be set through the parameters
// of the kinematicstate object
var oLocalKinematics = oNull.Kinematics.Local ;
oLocalKinematics.Parameters( "posx" ).Value = 10 ;
oLocalKinematics.Parameters( "posy" ).Value = 20 ;
oLocalKinematics.Parameters( "rotx" ).Value = 90 ;
oLocalKinematics.Parameters( "sclz" ).Value = 3 ;
// All the SRT values, plus many more parameters can 
// be read via the parameter collection
var oAllParameters = oLocalKinematics.Parameters ;
for ( var i = 0 ; i < oAllParameters.Count ; i++ )
{
        Application.LogMessage( oAllParameters(i).ScriptName + ":" + 
                                oAllParameters(i).Value ) ;
}
//Output:
//INFO : blendweight:1
//INFO : active:true
//INFO : posx:10
//INFO : posy:20
//INFO : posz:0
//INFO : rotx:90
//INFO : roty:0
//INFO : rotz:0
//INFO : quatw:0.7071067811865476
//INFO : quatx:0.7071067811865475
//INFO : quaty:0
//INFO : quatz:0
//INFO : sclx:1
//INFO : scly:1
//INFO : sclz:3
//INFO : sclorix:0
//INFO : scloriy:0
//INFO : scloriz:0
//INFO : cnsscl:true
//INFO : cnsori:true
//INFO : cnspos:true
//INFO : affbyscl:true
//INFO : affbyori:true
//INFO : posxmaxactive:false
//INFO : posxminactive:false
//INFO : posymaxactive:false
//INFO : posyminactive:false
//INFO : poszmaxactive:false
//INFO : poszminactive:false
//INFO : rotxmaxactive:false
//INFO : rotxminactive:false
//INFO : rotymaxactive:false
//INFO : rotyminactive:false
//INFO : rotzmaxactive:false
//INFO : rotzminactive:false
//INFO : siscaling:true
//INFO : rotorder:0
//INFO : pivotactive:true
//INFO : pposx:0
//INFO : pposy:0
//INFO : pposz:0
//INFO : protx:0
//INFO : proty:0
//INFO : protz:0
//INFO : psclx:1
//INFO : pscly:1
//INFO : psclz:1
//INFO : pivotcompactive:true
//INFO : pcposx:0
//INFO : pcposy:0
//INFO : pcposz:0
//INFO : pcrotx:0
//INFO : pcroty:0
//INFO : pcrotz:0
//INFO : pcsclx:1
//INFO : pcscly:1
//INFO : pcsclz:1
//INFO : nposx:0
//INFO : nposy:0
//INFO : nposz:0
//INFO : nrotx:0
//INFO : nroty:0
//INFO : nrotz:0
//INFO : nsclx:1
//INFO : nscly:1
//INFO : nsclz:1
//INFO : nsclorix:0
//INFO : nscloriy:0
//INFO : nscloriz:0

See Also

Kinematics.Global Kinematics.Local StaticKinematicState