Show in Contents

Add to Favorites

Home: Autodesk FBX SDK Progammer's Guide
Advanced Topics

Advanced Topics

Using multiple layers
Getting the transformation
matrix for a node
To get the default translation,
rotation, and scaling (default TRS properties) of a node,
call the node’s GetDefaultT(), GetDefaultR(), and GetDefaultS() member functions. All
three member functions return vectors of class KFbxVector4. The value of each vector
is an offset from the corresponding default TRS property vector
for 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 KFbxNode::GetLimits())
- The function curves (animation)
of the current take (see Animating a Scene).
You can get the node’s
actual TRS properties in the scene’s global coordinate system expressed
as a transformation matrix (often called
the transform) by calling the node’s GetGlobalFromDefaultTake() member function.
Computing the transformation matrix
Here is how FBX SDK computes the
transformation matrix for a node:
Transform =
T * Roff * Rp * Rpre * R * Rpost * Rp-1 * Soff * Sp * S * Sp-1
Where: |
Is: |
Transform |
Transformation matrix (4 X 4) |
T |
Translation |
Roff |
Rotation offset |
Rp |
Rotation pivot |
Rpre |
Pre-rotation |
R |
Rotation |
Rpost |
Post-rotation |
Rp-1
|
Inverse of the rotation pivot |
Soff |
Scaling offset |
Sp |
Scaling pivot |
S |
Scaling |
Sp-1
|
Inverse of the scaling pivot |
Notes:
- Computations are performed from left
to right.
- The effect of the formula is that any
given vector is first translated, then rotated, then scaled.
- The R matrix
takes into account the rotation order. Because of the
mathematical properties of the matrices, R is
the result of one of the possible combinations of Ry, Ry and Rz (each being matrices also). For
example, for the default rotation order of XYZ, R = Rx * Ry * Rz