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 GlobalTransformExamples
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.
| Property | Type | Description |
|---|---|---|
translation | Vector3 | World-space position of the node, in the coordinate system of the scene root. |
scale | Vector3 | World-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. |
rotation | Quaternion | World-space orientation as a unit quaternion. |
eulerAngles | Vector3 | World-space rotation expressed as Euler angles in radians, derived from the rotation quaternion. |
transformMatrix | Matrix4 | The full local-to-world 4×4 transformation matrix. |
Notes
GlobalTransformis computed at read time. There is no manual refresh step; every access tonode.globalTransformreturns a freshly computed snapshot.- The
scaleproperty onGlobalTransformcorresponds to the localscalingproperty onTransform. The name difference is intentional:scale(singular) indicates a world-space derived value, whilescaling(noun form) indicates the local settable property. - Geometric offsets (
geometricTranslation,geometricScaling,geometricRotationonTransform) are applied to the node’s own geometry but are not propagated to children;GlobalTransformdoes not include geometric offsets.