Transform is a component that defines the position, rotation, and scale of an actor in 3D space. It provides direction vectors, transformation matrix computation, and rotation utility functions.
More...
#include <Transform.h>
|
| Transform (Actor *pOwner, Vector3 pPosition=Vector3::Zero, Vector3 pScale=Vector3::One, Quaternion pRotation=Quaternion::Identity) |
| Constructor for Transform.
|
|
Vector3 | Right () const |
| Returns the right direction vector of the object (transformed by its current rotation).
|
|
Vector3 | Up () const |
| Returns the up direction vector of the object (transformed by its current rotation).
|
|
Vector3 | Forward () const |
| Returns the forward direction vector of the object (transformed by its current rotation).
|
|
void | ComputeWorldTransform () |
| Computes the world transformation matrix (position, rotation, scale). This is used to update the object's global transformation matrix.
|
|
const Matrix4 & | GetWorldTransform () const |
| Gets the world transformation matrix for this transform.
|
|
void | LookAt (Vector3 target) |
| Makes the object rotate to face a given target position.
|
|
void | RotatePitch (float degrees) |
| Rotates the object around the pitch axis (X-axis).
|
|
void | RotateYaw (float degrees) |
| Rotates the object around the yaw axis (Y-axis).
|
|
void | RotateRoll (float degrees) |
| Rotates the object around the roll axis (Z-axis).
|
|
| Component (Actor *pOwner, int pUpdateOrder=100) |
| Constructor for Component.
|
|
virtual | ~Component () |
|
virtual void | OnStart () |
| Called when the component is initialized (during actor start). This can be used to perform any setup operations for the component.
|
|
virtual void | Update () |
| Called every frame to update the component. This can be used to perform actions that need to be updated periodically.
|
|
virtual void | OnEnd () |
| Called when the component is about to be destroyed (during actor destruction). This can be used to clean up or release any resources.
|
|
virtual void | OnUpdateWorldTrandform () |
| Called when the world transform of the actor is updated. This allows the component to react to changes in the actor's world transform.
|
|
void | SetActive (bool isActive) |
| Sets the active status of the component.
|
|
void | SetOwner (Actor *pOwner) |
| Sets the actor that owns this component.
|
|
int | GetUpdateOrder () const |
| Returns the update order of the component. Components with lower update orders are updated first.
|
|
Actor * | GetOwner () const |
| Returns the actor that owns this component.
|
|
|
Actor * | mOwner = nullptr |
| The actor that owns this component.
|
|
Transform is a component that defines the position, rotation, and scale of an actor in 3D space. It provides direction vectors, transformation matrix computation, and rotation utility functions.
◆ Transform()
Constructor for Transform.
- Parameters
-
pOwner | The actor that owns this transform component. |
pPosition | The initial position of the actor in 3D space (default: Vector3::Zero). |
pScale | The initial scale of the actor (default: Vector3::One). |
pRotation | The initial rotation of the actor (default: Quaternion::Identity). |
◆ ComputeWorldTransform()
void Transform::ComputeWorldTransform |
( |
| ) |
|
Computes the world transformation matrix (position, rotation, scale). This is used to update the object's global transformation matrix.
◆ Forward()
Vector3 Transform::Forward |
( |
| ) |
const |
|
inline |
Returns the forward direction vector of the object (transformed by its current rotation).
- Returns
- Vector representing the forward direction in the world space.
◆ GetWorldTransform()
const Matrix4 & Transform::GetWorldTransform |
( |
| ) |
const |
Gets the world transformation matrix for this transform.
- Returns
- Reference to the world transformation matrix.
◆ LookAt()
void Transform::LookAt |
( |
Vector3 | target | ) |
|
Makes the object rotate to face a given target position.
- Parameters
-
target | The position to look at. |
◆ Right()
Returns the right direction vector of the object (transformed by its current rotation).
- Returns
- Vector representing the right direction in the world space.
◆ RotatePitch()
void Transform::RotatePitch |
( |
float | degrees | ) |
|
Rotates the object around the pitch axis (X-axis).
- Parameters
-
The | number of degrees to rotate around the pitch axis. |
◆ RotateRoll()
void Transform::RotateRoll |
( |
float | degrees | ) |
|
Rotates the object around the roll axis (Z-axis).
- Parameters
-
The | number of degrees to rotate around the roll axis. |
◆ RotateYaw()
void Transform::RotateYaw |
( |
float | degrees | ) |
|
Rotates the object around the yaw axis (Y-axis).
- Parameters
-
The | number of degrees to rotate around the yaw axis. |
◆ Up()
Returns the up direction vector of the object (transformed by its current rotation).
- Returns
- Vector representing the up direction in the world space.
◆ mPosition
Position of the object in 3D space.
◆ mRotation
Rotation of the object (in quaternion form)
◆ mScale
Scale of the object in 3D space.
The documentation for this class was generated from the following files: