GlobalTransform

GlobalTransform — Aspose.3D FOSS for Python API Reference

Overview

GlobalTransform is a read-only snapshot of a Node’s world-space transformation. It is obtained via node.global_transform and reflects the composition of the node’s own Transform with every ancestor’s transform up to the scene root.

All properties are read-only. To change a node’s position, modify the node’s local Transform instead.

Package: aspose.threed

from aspose.threed import GlobalTransform

GlobalTransform is not normally instantiated directly; you receive it from node.global_transform.

Properties

NameTypeDescription
translationVector3World-space position of the node
scaleVector3World-space scale of the node
rotationQuaternionWorld-space rotation as a quaternion
euler_anglesVector3World-space rotation as Euler angles in radians (roll, pitch, yaw)
transform_matrixMatrix4Complete 4×4 world-space transform matrix

Example

from aspose.threed import Scene
from aspose.threed.utilities import Vector3
import math

scene = Scene()

# Create a parent node at (10, 0, 0)
parent = scene.root_node.create_child_node("parent")
parent.transform.translation = Vector3(10.0, 0.0, 0.0)

# Create a child node at (5, 0, 0) relative to parent
child = parent.create_child_node("child")
child.transform.translation = Vector3(5.0, 0.0, 0.0)

# Read world-space position
gt = child.global_transform
print(gt.translation)          # Vector3(15.0, 0.0, 0.0)
print(gt.scale)                # Vector3(1.0, 1.0, 1.0)

# Access the 4x4 matrix directly
mat = gt.transform_matrix
print(mat.m03)   # 15.0 — world-space X translation

# Euler angles in degrees
angles = gt.euler_angles
print(math.degrees(angles.x))   # 0.0 (no rotation)

# Using evaluate_global_transform to include geometric offset
manual_mat = child.evaluate_global_transform(True)

Notes

  • GlobalTransform is computed at the time node.global_transform is accessed; it is not updated dynamically if a parent node’s Transform later changes.
  • The scale property name on GlobalTransform is scale (not scaling). The local Transform uses scaling for the writable scale property.

See Also