GlobalTransform
GlobalTransform je samo za čitanje snimak Nodesvetsku transformaciju. Dobija se putem node.getGlobalTransform() i odražava sastav sopstvene transformacije čvora Transform sa transformacijom svakog pretka sve do korena scene.
Sva svojstva su samo za čitanje. Da biste promenili položaj čvora, izmenite lokalnu Transform umesto toga.
import com.aspose.threed.GlobalTransform;GlobalTransform obično se ne instancira direktno; dobijate ga iz node.getGlobalTransform().
| Name | Type | Access | Description |
|---|---|---|---|
translation | Vector3 | Read | Gets the translation. |
scale | Vector3 | Read | Gets the scale. |
eulerAngles | Vector3 | Read | Gets the rotation represented in Euler angles, measured in degree. |
rotation | Quaternion | Read | Gets the rotation represented in quaternion. |
transformMatrix | Matrix4 | Read | Gets the transform matrix. |
| Signature | Description |
|---|---|
GlobalTransform() | Initializes a new instance of the GlobalTransform class. |
GlobalTransform(matrix: Matrix4) | Initializes a new instance of the GlobalTransform class with the specified matrix. |
getTranslation() → Vector3 | Gets the translation. |
getScale() → Vector3 | Gets the scale. |
getEulerAngles() → Vector3 | Gets the rotation represented in Euler angles, measured in degree. |
getRotation() → Quaternion | Gets the rotation represented in quaternion. |
getTransformMatrix() → Matrix4 | Gets the transform matrix. |
import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.GlobalTransform;
import com.aspose.threed.*;
Scene scene = new Scene();
// Create a parent node at (10, 0, 0)
Node parent = scene.getRootNode().createChildNode("parent");
parent.getTransform().setTranslation(new Vector3(10.0, 0.0, 0.0));
// Create a child node at (5, 0, 0) relative to parent
Node child = parent.createChildNode("child");
child.getTransform().setTranslation(new Vector3(5.0, 0.0, 0.0));
// Read world-space position
GlobalTransform gt = child.getGlobalTransform();
System.out.println(gt.getTranslation()); // Vector3(15.0, 0.0, 0.0)
System.out.println(gt.getScale()); // Vector3(1.0, 1.0, 1.0)
// Access the 4x4 matrix directly
Matrix4 mat = gt.getTransformMatrix();
System.out.println(mat.m03); // 15.0 -- world-space X translation
// Euler angles in degrees
Vector3 angles = gt.getEulerAngles();
System.out.println(Math.toDegrees(angles.x)); // 0.0 (no rotation)
// Using evaluateGlobalTransform to include geometric offset
Matrix4 manualMat = child.evaluateGlobalTransform(true);GlobalTransformse izračunava u trenutkunode.getGlobalTransform()se pristupa; to je ne ažurira dinamički ako je roditeljski čvorTransformkasnije promene.- Getter je
getScale()naGlobalTransform(negetScaling()). LokalniTransformkoristigetScaling()za svojstvo upisive skale.