Object Hierarchy | Related C++ Class: CTransformation
This object represents a transformation which is the result of the combination of a Scaling, a Rotation and a Translation, in the S.R.T order.
/*
Example of how to use the SITransformation to read and write
the scaling, rotation and translation of an object
*/
var oNull = Application.ActiveSceneRoot.AddNull( "MyNull" ) ;
// Change the position and rotation of the null
// by providing a new transform
oNewLocalTransform = XSIMath.CreateTransform() ;
// Change posx, posy
oNewLocalTransform.PosX = 5;
oNewLocalTransform.PosX = 6;
// Set rotx to 180 degrees
oNewLocalTransform.RotX = 180;
// Scale y-axis (scly)
oNewLocalTransform.SclY = 2;
oNull.Kinematics.Local.Transform = oNewLocalTransform ;
PrintTransformation( oNull.Kinematics.Local.Transform ) ;
// 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:
//INFO : Scaling: 1, 2, 1
//INFO : Rotation: 3.142, 0, 0
//INFO : Translation: 5, 6, 0
|
dim transfo set transfo = XSIMath.CreateTransform Application.LogMessage TypeName(transfo) |
SIVector3 SIMatrix3 SIMatrix4 SIRotation SITransformation SIQuaternion KinematicState.Transform StaticKinematicState.Transform