GlobalTransform

GlobalTransform — Aspose.3D FOSS for Python API Reference

Example

GlobalTransform読み取り専用 のスナップショット Nodeのワールド空間変換です。取得は以下を通じて行われます node.global_transform そして、ノード自身の Transform すべての先祖ノードの変換とシーンルートまでを組み合わせたものです。.

すべてのプロパティは読み取り専用です。ノードの位置を変更するには、ノードのローカル Transform 代わりに。.

Example: aspose.threed

from aspose.threed import GlobalTransform

GlobalTransform は通常直接インスタンス化されません; 取得元は node.global_transform.

Example

ExampleExampleExample
translationVector3ノードのワールド空間位置
scaleVector3ノードのワールド空間スケール
rotationQuaternionクォータニオンとしてのワールド空間回転
euler_anglesVector3ラジアン単位のオイラー角としてのワールド空間回転 (roll, pitch, yaw)
transform_matrixMatrix4完全な4×4ワールド空間変換行列

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)

Example

  • GlobalTransform はその時点で計算されます node.global_transform にアクセスされます; それは ではありません 親ノードのがある場合、動的に更新されます Transform 後の変更。.
  • Example scale のプロパティ名 GlobalTransform です scale (not scaling). ローカル Transform 使用します scaling 書き込み可能なスケールプロパティ用に。.

参照

 日本語