Class GlobalTransform

Class GlobalTransform

Package: @aspose/3d (v24.12.0)

GlobalTransform provides a read-only view of a node’s world-space transformation. It is obtained from node.globalTransform and is computed by multiplying the local Transform matrices of the node and all its ancestors. All properties are read-only; to change a node’s world position you must modify the local Transform of the node or one of its ancestors.

export class GlobalTransform

Examples

Read the world-space position of a nested node after loading an FBX file.

import { Scene } from '@aspose/3d';

const scene = new Scene();
scene.open('character.fbx');

function printWorldPositions(node: any, depth: number = 0): void {
  const gt = node.globalTransform;
  const t = gt.translation;
  console.log(`${'  '.repeat(depth)}${node.name}: (${t.x.toFixed(3)}, ${t.y.toFixed(3)}, ${t.z.toFixed(3)})`);
  for (const child of node.childNodes) {
    printWorldPositions(child, depth + 1);
  }
}

printWorldPositions(scene.rootNode);

Properties

All properties on GlobalTransform are read-only.

PropertyTypeDescription
translationVector3World-space position of the node, in the coordinate system of the scene root.
scaleVector3World-space scale — the product of the node’s local scaling and all ancestor scalings. Note: this property is named scale (not scaling) to distinguish it from the local-space Transform.scaling.
rotationQuaternionWorld-space orientation as a unit quaternion.
eulerAnglesVector3World-space rotation expressed as Euler angles in radians, derived from the rotation quaternion.
transformMatrixMatrix4The full local-to-world 4×4 transformation matrix.

Notes

  • GlobalTransform is computed at read time. There is no manual refresh step; every access to node.globalTransform returns a freshly computed snapshot.
  • The scale property on GlobalTransform corresponds to the local scaling property on Transform. The name difference is intentional: scale (singular) indicates a world-space derived value, while scaling (noun form) indicates the local settable property.
  • Geometric offsets (geometricTranslation, geometricScaling, geometricRotation on Transform) are applied to the node’s own geometry but are not propagated to children; GlobalTransform does not include geometric offsets.