GlobalTransform

GlobalTransform

Methods

GlobalTransform เป็น อ่าน‑อย่างเดียว ภาพสแนปช็อตของ Node’s การแปลงเชิงพื้นที่โลก. ได้มาผ่าน node.global_transform และสะท้อนการประกอบของโหนดเอง Transform กับการแปลงของบรรพบุรุษทุกระดับจนถึงรากของฉาก.

คุณสมบัติทั้งหมดเป็นแบบอ่าน‑อย่างเดียว. เพื่อเปลี่ยนตำแหน่งของโหนด ให้แก้ไขค่า local ของโหนด Transform แทน.

Methods: aspose.threed

from aspose.threed import GlobalTransform

GlobalTransform โดยปกติจะไม่ถูกสร้างโดยตรง; คุณจะได้รับมันจาก node.global_transform.

Methods

MethodsMethodsMethods
translationVector3ตำแหน่งในระบบพิกัดโลกของโหนด
scaleVector3สเกลในระบบพิกัดโลกของโหนด
rotationQuaternionการหมุนในระบบพิกัดโลกเป็น quaternion
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 สำหรับคุณสมบัติสเกลที่เขียนได้.

ดูเพิ่มเติม

 ภาษาไทย