KinematicState.GetTransform2
 
 
 

KinematicState.GetTransform2 operator

Introduced

v6.0

Description

Returns the transformation of an object.

Note: This is the Python-compliant version of the KinematicState.Transform property (for getting the transformation). Since Python does not support input parameters on properties, KinematicState.Transform will fail in Python.

Warning: The returned SITransformation object contains a copy of the transformation values, so modifying its state will have no effect on the original object. To change the object's kinematic state you must set KinematicState.PutTransform2 with the modified SITransformation object, as shown in the example below.

C# Syntax

Object KinematicState.GetTransform2( Object inFrame );

Scripting Syntax

oReturn = KinematicState.GetTransform2( [Frame] );

Return Value

SITransformation

Parameters

Parameter Type Description
Frame Variant Frame at which to get the transform. Pass null for current time.

Examples

Python Example

#
# This example shows how to modify the state of a transform 
# when you are working on a copy of the object.
#
app = Application
null = None
false = 0
app.NewScene (null, false)
oRoot = app.ActiveSceneRoot
oCube = oRoot.AddGeometry("Cube","MeshSurface", "Cube")
# Retrieve a copy of the transform object
oTrans = oCube.Kinematics.Local.GetTransform2(null)
oMat4 = XSIMath.CreateMatrix4();
oMat4.Set( 1.0, 1.0, 0.0, 10.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,0.0, 0.0, 0.0, 1.0 );
# Warning: you cannot change the object's transform like this: 
# oCube.Kinematics.Local.Transform.SetMatrix4(oMat4);
# because this will only modify a copy of the transform object
# not the real state of oCube.Kinematics.Local.Transform
oTrans.SetMatrix4(oMat4);
# Replace the transform with the modified copy 
oCube.Kinematics.Local.PutTransform2(null, oTrans)

See Also

KinematicState.Transform KinematicState.PutTransform2