RotationStateComponent Class
Component that manages composite rotation from heading and spin rotations. More...
Declaration
Base class
| class | Component |
|
Abstract base class for components attached to GameObjects. More... | |
Public Member Functions Index
| void | setHeadingRotationAngle (float angle) |
|
Sets the heading rotation angle. More... | |
| float | headingRotationAngle () const noexcept |
|
Returns the current heading rotation angle. More... | |
| void | setHeadingRotationAxis (helios::math::vec3f axis) |
|
Sets the heading rotation axis. More... | |
| helios::math::vec3f | headingRotationAxis () const noexcept |
|
Returns the heading rotation axis. More... | |
| void | setSpinRotationAngle (float angle) |
|
Sets the spin rotation angle. More... | |
| float | spinRotationAngle () const noexcept |
|
Returns the current spin rotation angle. More... | |
| void | setSpinRotationAxis (helios::math::vec3f axis) |
|
Sets the spin rotation axis. More... | |
| helios::math::vec3f | spinRotationAxis () const noexcept |
|
Returns the spin rotation axis. More... | |
| const helios::math::mat4f & | spinRotation () noexcept |
|
Returns the spin rotation matrix. More... | |
| const helios::math::mat4f & | headingRotation () noexcept |
|
Returns the heading rotation matrix. More... | |
| const helios::math::mat4f & | rotation () noexcept |
|
Returns the composed rotation matrix (heading * spin). More... | |
Private Member Functions Index
| void | update () |
|
Recalculates rotation matrices if dirty. More... | |
Private Member Attributes Index
| float | headingRotationAngle_ = 0.0f |
|
Current heading rotation angle in degrees. More... | |
| helios::math::vec3f | headingRotationAxis_ {} |
|
Axis around which heading rotation occurs. More... | |
| float | spinRotationAngle_ = 0.0f |
|
Current spin rotation angle in degrees. More... | |
| helios::math::vec3f | spinRotationAxis_ {} |
|
Axis around which spin rotation occurs. More... | |
| bool | needsUpdate_ = true |
|
Dirty flag indicating matrices need recalculation. More... | |
| helios::math::mat4f | spinRotationMatrix_ |
|
Cached spin rotation matrix. More... | |
| helios::math::mat4f | headingRotationMatrix_ |
|
Cached heading rotation matrix. More... | |
| helios::math::mat4f | composedRotationMatrix_ |
|
Cached composed rotation matrix (heading * spin). More... | |
Description
Component that manages composite rotation from heading and spin rotations.
This component combines two independent rotation sources:
- **Heading Rotation:** The direction the entity is facing (controlled by input).
- **Spin Rotation:** Additional rotation for visual effects (e.g., rolling, tumbling).
The component caches the computed rotation matrices and only recalculates them when the underlying angles or axes change (dirty flag pattern).
Definition at line 28 of file RotationStateComponent.ixx.
Public Member Functions
headingRotation()
| inline noexcept |
Returns the heading rotation matrix.
Triggers matrix update if dirty.
- Returns
Const reference to the heading rotation matrix.
Definition at line 198 of file RotationStateComponent.ixx.
headingRotationAngle()
| inline nodiscard noexcept |
Returns the current heading rotation angle.
- Returns
The heading rotation angle in degrees.
Definition at line 118 of file RotationStateComponent.ixx.
headingRotationAxis()
| inline nodiscard noexcept |
Returns the heading rotation axis.
- Returns
The current heading rotation axis.
Definition at line 137 of file RotationStateComponent.ixx.
rotation()
| inline noexcept |
Returns the composed rotation matrix (heading * spin).
Triggers matrix update if dirty.
- Returns
Const reference to the composed rotation matrix.
Definition at line 210 of file RotationStateComponent.ixx.
setHeadingRotationAngle()
| inline |
Sets the heading rotation angle.
- Parameters
-
angle The new heading rotation angle in degrees (wrapped to 0-360).
Definition at line 108 of file RotationStateComponent.ixx.
setHeadingRotationAxis()
| inline |
Sets the heading rotation axis.
- Parameters
-
axis The new rotation axis (should be normalized).
Definition at line 127 of file RotationStateComponent.ixx.
setSpinRotationAngle()
| inline |
Sets the spin rotation angle.
- Parameters
-
angle The new spin rotation angle in degrees (wrapped to 0-360).
Definition at line 146 of file RotationStateComponent.ixx.
setSpinRotationAxis()
| inline |
Sets the spin rotation axis.
- Parameters
-
axis The new spin rotation axis (should be normalized).
Definition at line 165 of file RotationStateComponent.ixx.
spinRotation()
| inline noexcept |
Returns the spin rotation matrix.
Triggers matrix update if dirty.
- Returns
Const reference to the spin rotation matrix.
Definition at line 186 of file RotationStateComponent.ixx.
spinRotationAngle()
| inline nodiscard noexcept |
Returns the current spin rotation angle.
- Returns
The spin rotation angle in degrees.
Definition at line 156 of file RotationStateComponent.ixx.
spinRotationAxis()
| inline nodiscard noexcept |
Returns the spin rotation axis.
- Returns
The current spin rotation axis.
Definition at line 175 of file RotationStateComponent.ixx.
Private Member Functions
update()
| inline |
Recalculates rotation matrices if dirty.
Updates spinRotationMatrix_, headingRotationMatrix_, and composedRotationMatrix_ based on current angles and axes.
Definition at line 78 of file RotationStateComponent.ixx.
Private Member Attributes
composedRotationMatrix_
|
Cached composed rotation matrix (heading * spin).
Definition at line 68 of file RotationStateComponent.ixx.
headingRotationAngle_
|
Current heading rotation angle in degrees.
Definition at line 33 of file RotationStateComponent.ixx.
headingRotationAxis_
|
Axis around which heading rotation occurs.
Definition at line 38 of file RotationStateComponent.ixx.
headingRotationMatrix_
|
Cached heading rotation matrix.
Definition at line 63 of file RotationStateComponent.ixx.
needsUpdate_
|
Dirty flag indicating matrices need recalculation.
Definition at line 53 of file RotationStateComponent.ixx.
spinRotationAngle_
|
Current spin rotation angle in degrees.
Definition at line 43 of file RotationStateComponent.ixx.
spinRotationAxis_
|
Axis around which spin rotation occurs.
Definition at line 48 of file RotationStateComponent.ixx.
spinRotationMatrix_
|
Cached spin rotation matrix.
Definition at line 58 of file RotationStateComponent.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.