LocalTranslation (X3DObject)

Introduced

3.5.1

Description

Returns or sets the object's local translation. This acts as a shortcut to accessing the translation SIVector3 through Kinematics, local KinematicState, and SITransformation.

C# Syntax

    // get accessor
    Object rtn = X3DObject.LocalTranslation;

    // set accessor
    X3DObject.LocalTranslation = Object;

Examples

1. JScript Example

    /*
       This example illustrates how to get/set the local translation using two
       different approaches
    */
    NewScene( null, false );
    var oNull1 = Application.ActiveSceneRoot.AddNull();
    oNull1.posx.Value = 45;

    var oNull2 = Application.ActiveSceneRoot.AddNull();
    oNull2.posx.Value = 19;

    // ACCESSING
    // Access the local translation using the KinematicState
    var oTransform = oNull1.Kinematics.Local.Transform;
    var oTranslation = oTransform.Translation;

    // Access the local translation using X3DObject.LocalTranslation
    var oTranslation2 = oNull2.LocalTranslation;

    Application.LogMessage( "Null1 pos x - " + oTranslation.X );
    Application.LogMessage( "Null2 pos x - " + oTranslation2.X );

    // SETTING
    // Set the translation using the KinematicState
    oTransform.SetTranslationFromValues( 2.0, 1.0, 0.0 );
    oNull1.Kinematics.Local.Transform = oTransform;

    // Set the translation using X3DObject.LocalTranslation
    oTranslation2.Set( 2.0, 1.0, 0.0 );
    oNull2.LocalTranslation = oTranslation2;

    // Expected results:
    //INFO : Null1 pos x - 45
    //INFO : Null2 pos x - 19

2. VBScript Example

    '
    ' This example illustrates how to get/set local translation using
    ' two different approaches
    '
    set oNull1 = Application.ActiveSceneRoot.AddNull()
    set oNull2 = Application.ActiveSceneRoot.AddNull()

    ' ACCESSING
    ' Access the local translation using the KinematicState
    set oTransform = oNull1.Kinematics.Local.Transform
    set oTranslation = oTransform.Translation

    ' Access the local translation using X3DObject.LocalTranslation
    set oTranslation2 = oNull2.LocalTranslation

    ' SETTING
    ' Set the local translation using the KinematicState
    oTransform.SetTranslationFromValues 2.0, 1.0, 0.0
    oNull1.Kinematics.Local.Transform = oTransform

    ' Set the local translation using X3DObject.LocalTranslation
    oTranslation2.Set 2.0, 1.0, 0.0
    oNull2.LocalTranslation = oTranslation2

Autodesk Softimage v7.5