GlobalTransform

GlobalTransform

Methods

GlobalTransform є лише для читання знімок Nodeперетворення у світовому просторі. Воно отримується за допомогою node.global_transform і відображає композицію власного Transform з трансформаціями всіх предків до кореня сцени.

Усі властивості лише для читання. Щоб змінити позицію вузла, змініть локальне Transform замість цього.

Methods: aspose.threed

from aspose.threed import GlobalTransform

GlobalTransform зазвичай не створюється безпосередньо; ви отримуєте його від node.global_transform.

Methods

MethodsMethodsMethods
translationVector3Позиція вузла у світовому просторі
scaleVector3Масштаб вузла у світовому просторі
rotationQuaternionОбертання у світовому просторі у вигляді кватерніону
euler_anglesVector3Обертання у світовому просторі у вигляді кутів Ейлера в радіанах (roll, pitch, yaw)
transform_matrixMatrix4Повна 4×4 матриця трансформації у світовому просторі

Methods

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)

Methods

  • GlobalTransform обчислюється в момент node.global_transform доступається; це не оновлюється динамічно, якщо батьківський вузол Transform пізніше змінюється.
  • Methods scale назва властивості на GlobalTransform є scale (не scaling). Локальний Transform використовує scaling для записуваної властивості масштабу.

Див. також

 Українська