GlobalTransform — Aspose.3D FOSS for Python API Reference
Overview
GlobalTransform เป็น อ่านอย่างเดียว ภาพถ่ายของ Node’s การแปลงเชิงพื้นที่โลก. ได้มาผ่าน node.global_transform และสะท้อนการประกอบของโหนดเอง Transform กับการแปลงของบรรพบุรุษทุกระดับจนถึงรากของฉาก.
คุณสมบัติทั้งหมดเป็นแบบอ่านอย่างเดียว. เพื่อเปลี่ยนตำแหน่งของโหนด, แก้ไข local ของโหนด Transform แทน.
Overview: aspose.threed
from aspose.threed import GlobalTransformGlobalTransform ไม่ได้ถูกสร้างขึ้นโดยตรงโดยปกติ; คุณจะได้รับจาก node.global_transform.
Overview
| Overview | Overview | Overview |
|---|---|---|
translation | Vector3 | ตำแหน่งเชิงพื้นที่โลกของโหนด |
scale | Vector3 | สเกลเชิงพื้นที่โลกของโหนด |
rotation | Quaternion | การหมุนเชิงพื้นที่โลกในรูป quaternion |
euler_angles | Vector3 | การหมุนเชิงพื้นที่โลกในรูปแบบมุมออยเลอร์เป็นเรเดียน (roll, pitch, yaw) |
transform_matrix | Matrix4 | เมทริกซ์การแปลงเชิงพื้นที่โลก 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สำหรับคุณสมบัติสเกลที่เขียนได้.