GlobalTransform

GlobalTransform — Aspose.3D FOSS for Python API Reference

Overview

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

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

Overview: aspose.threed

from aspose.threed import GlobalTransform

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

Overview

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

Overview

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)

Overview

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

Див. також

 Українська