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 GlobalTransformGlobalTransform is not normally instantiated directly; you receive it from node.global_transform.
Properties
| Name | Type | Description |
|---|---|---|
translation | Vector3 | World-space position of the node |
scale | Vector3 | World-space scale of the node |
rotation | Quaternion | World-space rotation as a quaternion |
euler_angles | Vector3 | World-space rotation as Euler angles in radians (roll, pitch, yaw) |
transform_matrix | Matrix4 | Complete 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
GlobalTransformis computed at the timenode.global_transformis accessed; it is not updated dynamically if a parent node’sTransformlater changes.- The
scaleproperty name onGlobalTransformisscale(notscaling). The localTransformusesscalingfor the writable scale property.