FBX SDK Programmer's Guide > Nodes and the Scene Graph > FBX Nodes >

# Transformation Data

## Translation, Rotation and Scaling Vectors

The default translation, rotation, and scaling (default TRS properties) of a node are accessed using the FbxNode::LclTranslation, FbxNode::LclRotation, and FbxNode::LclScaling properties:

    // Get the node’s default TRS properties
    FbxDouble3 lTranslation = lNode->LclTranslation.Get();
    FbxDouble3 lRotation    = lNode->LclRotation.Get();
    FbxDouble3 lScaling     = lNode->LclScaling.Get();

The FbxTypedPropertyAll three member functions return vectors of type FbxDouble3. The value of each vector is a triplet of X, Y, and Z coordinates. The value of one of these vectors is an offset from the corresponding default TRS property vector for the parent node. A node’s default TRS properties are therefore local to the parent node.

The actual TRS properties for the node at a given point in time depend on:

- The node’s default TRS properties.
- The limits that apply to the node (see FbxNode::GetLimits()).
- The constraints that apply to the node (see FbxConstraint and its subclasses).
- The animation curves of the current animation stack. For more information, see Animation.

## Global and Local Transformation Matrices

A node's global and local transformation matrices can be respectively obtained by calling FbxNode::EvaluateGlobalTransform() and FbxNode::EvaluateLocalTransform():

    // Get the node's default global transformation matrix.
    FbxAMatrix& lGlobalTransform = lNode->EvaluateGlobalTransform();

    // Get the node's default local transformation matrix.
    FbxAMatrix& lLocalTransform = lNode->EvaluateLocalTransform();

These member functions are equivalent to using the FbxScene's animation evaluator FbxAnimEvaluator::GetNodeGlobalTransform() and FbxAnimEvaluator::GetNodeLocalTransform() functions:

    // Get the scene's animation evaluator.
    FbxAnimEvaluator* lEvaluator = lScene->getEvaluator();

    // Get the node's default global transformation matrix.
    FbxAMatrix& lGlobalTransform = lEvaluator->GetNodeGlobalTransform(lNode);

    // Get the node's default local transformation matrix.
    FbxAMatrix& lLocalTransform = lEvaluator->GetNodeLocalTransform(lNode);

An animated node's transformation matrix can be obtained for a specific point in time by passing a FbxTime object.

    FbxTime lTime;

    // Set the time at two seconds.
    lTime.SetSecondDouble((float) 2);

    // Get the node's global transformation matrix at 2 seconds.
    FbxAMatrix& lGlobalTransform = lNode->EvaluateGlobalTransform(lTime);

NoteA node's global transformation matrix of cannot be explicitly set in the FBX SDK.

## Geometric Transformation Properties

The FbxNode geometric transformation properties (FbxNode::GeometricTranslation, FbxNode::GeometricRotation, and FbxNode::GeometricScaling) describe how a FbxNodeAttribute is offset from the FbxNode's local frame of reference. These geometric transforms are applied to the FbxNodeAttribute after the FbxNode's local transforms are computed, and are not inherited across the node hierarchy.

NoteThe geometric transformation properties are related to how 3ds Max represents pivot information. It is comparable to 3ds Max's object-offset transformation.

## Baking Transform Components Into the Standard TRS Transforms

The FbxNode::ConvertPivotAnimationRecursive() function lets you bake transform components: pre- and post-rotation, rotation and scale pivots and offsets - inside the standard transforms - Translation, Rotation, Scaling. Here is a code snippet.

    // Do this setup for each node (FbxNode).
    // We set up what we want to bake via ConvertPivotAnimationRecursive.
    // When the destination is set to 0, baking will occur.
    // When the destination value is set to the source’s value, the source values will be retained and not baked.
    {
        FbxVector4 lZero(0,0,0);

        // Activate pivot converting
        pNode->SetPivotState(FbxNode::eSOURCE_SET, FbxNode::ePIVOT_STATE_ACTIVE);
        pNode->SetPivotState(FbxNode::eDESTINATION_SET, FbxNode::ePIVOT_STATE_ACTIVE);

        // We want to set all these to 0 and bake them into the transforms.
        pNode->SetPostRotation(FbxNode::eDESTINATION_SET, lZero);
        pNode->SetPreRotation(FbxNode::eDESTINATION_SET, lZero);
        pNode->SetRotationOffset(FbxNode::eDESTINATION_SET, lZero);
        pNode->SetScalingOffset(FbxNode::eDESTINATION_SET, lZero);
        pNode->SetRotationPivot(FbxNode::eDESTINATION_SET, lZero);
        pNode->SetScalingPivot(FbxNode::eDESTINATION_SET, lZero);

        // This is to import in a system that supports rotation order.
        // If rotation order is not supported, do this instead:
        // pNode->SetRotationOrder(FbxNode::eDESTINATION_SET , FbxNode::eEULER_XYZ);
        ERotationOrder lRotationOrder;
        pNode->GetRotationOrder(FbxNode::eSOURCE_SET , lRotationOrder);
        pNode->SetRotationOrder(FbxNode::eDESTINATION_SET , lRotationOrder);

        // Similarly, this is the case where geometric transforms are supported by the system.
        // If geometric transforms are not supported, set them to zero instead of
        // the source’s geometric transforms.
        // Geometric transform = local transform, not inherited by children.
        pNode->SetGeometricTranslation(FbxNode::eDESTINATION_SET, pNode->GetGeometricTranslation(FbxNode::eSOURCE_SET));
        pNode->SetGeometricRotation(FbxNode::eDESTINATION_SET, pNode->GetGeometricRotation(FbxNode::eSOURCE_SET));
        pNode->SetGeometricScaling(FbxNode::eDESTINATION_SET, pNode->GetGeometricScaling(FbxNode::eSOURCE_SET));

        // Idem for quaternions.
        pNode->SetUseQuaternionForInterpolation(FbxNode::eDESTINATION_SET, pNode->GetUseQuaternionForInterpolation(FbxNode::eSOURCE_SET));
    }

    // When the setup is done, call ConvertPivotAnimationRecursive to the scene’s root node.
    // Sampling rate e.g. 30.0.
    mScene->GetRootNode()->ConvertPivotAnimationRecursive(FbxNode::eDESTINATION_SET, lSamplingRate );

NoteTo avoid re-computing the pivots matrices and updating the animation curves each time one of the parameters is changed, the FBX SDK only applies the new settings when an explicit call is made to ResetPivotSetAndConvertAnimation() or ConvertPivotAnimationRecursive().