Represents the position, rotation, and scale of a GameObject in 3D space. The Transform class encapsulates the local and world transformations of a GameObject, including its position, rotation, and scale. It also supports hierarchical relationships through parent-child transforms.
More...
#include <transform.h>
Represents the position, rotation, and scale of a GameObject in 3D space. The Transform class encapsulates the local and world transformations of a GameObject, including its position, rotation, and scale. It also supports hierarchical relationships through parent-child transforms.
- Note
- The position is represented as a Vector3, the rotation as a float (in degrees), and the scale as a Vector3.
-
The parent transform is optional, allowing for both root and child transforms.
-
Modifying the local position, rotation, or scale will affect the world transformation based on the parent's transformation.
-
This class does not handle matrix transformations; it focuses on the basic representation of position, rotation, and scale.
◆ Transform() [1/4]
◆ Transform() [2/4]
| Transform::Transform |
( |
Vector3 |
position | ) |
|
|
explicit |
◆ Transform() [3/4]
| Transform::Transform |
( |
Vector3 |
position, |
|
|
float |
rotation, |
|
|
Vector3 |
scale |
|
) |
| |
◆ Transform() [4/4]
| Transform::Transform |
( |
Vector3 |
position, |
|
|
float |
rotation, |
|
|
Vector3 |
scale, |
|
|
std::optional< std::reference_wrapper< Transform > > |
parent |
|
) |
| |
◆ local_position() [1/2]
| Vector3 Transform::local_position |
( |
| ) |
const |
|
noexcept |
Get the local position of the Transform.
- Returns
- The local position as a Vector3.
◆ local_position() [2/2]
Set the local position of the Transform.
- Parameters
-
| pos | The new local position as a Vector3. |
- Returns
- A reference to this Transform for chaining.
◆ parent() [1/2]
| std::optional< std::reference_wrapper< Transform > > Transform::parent |
( |
| ) |
const |
|
noexcept |
◆ parent() [2/2]
| Transform & Transform::parent |
( |
std::optional< std::reference_wrapper< Transform > > |
parent | ) |
|
|
noexcept |
Set the parent Transform.
- Parameters
-
| parent | An optional reference to the new parent Transform. |
- Returns
- A reference to this Transform for chaining.
◆ position() [1/2]
| Vector3 Transform::position |
( |
| ) |
const |
|
noexcept |
Get the world position of the Transform.
- Returns
- The world position as a Vector3.
◆ position() [2/2]
Set the world position of the Transform.
- Parameters
-
| pos | The new world position as a Vector3. |
- Returns
- A reference to this Transform for chaining.
◆ rotation() [1/2]
| float Transform::rotation |
( |
| ) |
const |
|
noexcept |
Get the rotation of the Transform in degrees.
- Returns
- The rotation in degrees.
◆ rotation() [2/2]
Set the rotation of the Transform in degrees.
- Parameters
-
| rot | The new rotation in degrees. |
- Returns
- A reference to this Transform for chaining.
◆ scale() [1/2]
◆ scale() [2/2]
Set the scale of the Transform.
- Parameters
-
- Returns
- A reference to this Transform for chaining.
The documentation for this class was generated from the following file: