You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Transform class represents an object's position, rotation, and scale in the scene graph. It supports parent-child relationships, allowing for hierarchical transformations. This is similar to Unity's Transform component.
/** * Constructs a new Transform with default position (0,0,0), rotation (0,0,0), and scale (1,1,1). */publicTransform()
/** * Adds a child Transform to this Transform. * @param child The child Transform to add */publicvoidaddChild(Transformchild)
/** * Removes a child Transform from this Transform. * @param child The child Transform to remove */publicvoidremoveChild(Transformchild)
/** * Returns the parent Transform. * @return The parent Transform, or null if root */publicTransformgetParent()
/** * Returns the list of child Transforms. * @return List of child Transforms */publicList<Transform> getChildren()
/** * Returns the local position relative to the parent. * @return Local position vector */publicVectorgetLocalPosition()
/** * Returns the local rotation. * @return Local rotation vector */publicVectorgetLocalRotation()
/** * Returns the local scale. * @return Local scale vector */publicVectorgetLocalScale()
/** * Sets the local position. * @param pos The new local position */publicvoidsetLocalPosition(Vectorpos)
/** * Sets the local rotation. * @param rot The new local rotation */publicvoidsetLocalRotation(Vectorrot)
/** * Sets the local scale. * @param scale The new local scale */publicvoidsetLocalScale(Vectorscale)
/** * Returns the transformation matrix built from position, rotation, and scale. * @return Local transformation Matrix4 */publicMatrix4getLocalMatrix()
/** * Returns the world transformation matrix by combining with parent transforms recursively. * @return World transformation Matrix4 */publicMatrix4getWorldMatrix()
/** * Gets the position in world space. * @return World position vector */publicVectorgetWorldPosition()
/** * Gets the rotation in world space by recursively adding parent rotations. * @return World rotation vector */publicVectorgetWorldRotation()
/** * Gets the scale in world space by accumulating parent scales. * @return World scale vector */publicVectorgetWorldScale()
/** * Sets the world position, adjusting local values accordingly. * @param pos The new world position */publicvoidsetWorldPosition(Vectorpos)
/** * Sets the world rotation, adjusting local values accordingly. * @param rot The new world rotation */publicvoidsetWorldRotation(Vectorrot)
/** * Sets the world scale, adjusting local values accordingly. * @param scale The new world scale */publicvoidsetWorldScale(Vectorscale)
/** * Sets the owning GameObject for this Transform. * @param go The GameObject to set */publicvoidsetGameObject(GameObjectgo)
/** * Gets the owning GameObject for this Transform. * @return The GameObject */publicGameObjectgetGameObject()
/** * Destroys this Transform and all its children, removing them from the hierarchy. */publicvoiddestroy()