Skip to main content

DirectionComponent Class

Component that holds a normalized direction vector. More...

Declaration

class helios::engine::modules::physics::motion::components::DirectionComponent { ... }

Public Constructors Index

DirectionComponent ()=default

Default constructor. More...

DirectionComponent (const DirectionComponent &other)

Copy constructor. More...

DirectionComponent (DirectionComponent &&) noexcept=default

Public Operators Index

DirectionComponent &operator= (const DirectionComponent &)=default
DirectionComponent &operator= (DirectionComponent &&) noexcept=default

Public Member Functions Index

boolisEnabled () const noexcept

Checks whether this component is enabled. More...

voidenable () noexcept

Enables this component. More...

voiddisable () noexcept

Disables this component. More...

voidsetDirection (const helios::math::vec3f direction) noexcept

Sets the direction vector. More...

helios::math::vec3fdirection () const noexcept

Retrieves the stored direction vector. More...

Private Member Attributes Index

helios::math::vec3fdirection_ {}

The stored normalized direction vector. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that holds a normalized direction vector.

This component is used to store a direction for various purposes, such as movement direction, facing direction, or other vector-based properties. It enforces normalization of the stored vector.

Definition at line 26 of file DirectionComponent.ixx.

Public Constructors

DirectionComponent()

helios::engine::modules::physics::motion::components::DirectionComponent::DirectionComponent ()
default

Default constructor.

Definition at line 66 of file DirectionComponent.ixx.

Referenced by DirectionComponent, DirectionComponent, operator= and operator=.

DirectionComponent()

helios::engine::modules::physics::motion::components::DirectionComponent::DirectionComponent (const DirectionComponent & other)
inline

Copy constructor.

Parameters
other

The component to copy from.

Definition at line 73 of file DirectionComponent.ixx.

73 DirectionComponent(const DirectionComponent& other) : direction_(other.direction()) {}

References direction and DirectionComponent.

DirectionComponent()

helios::engine::modules::physics::motion::components::DirectionComponent::DirectionComponent (DirectionComponent &&)
noexcept default

Definition at line 76 of file DirectionComponent.ixx.

Reference DirectionComponent.

Public Operators

operator=()

DirectionComponent & helios::engine::modules::physics::motion::components::DirectionComponent::operator= (const DirectionComponent &)
default

Definition at line 75 of file DirectionComponent.ixx.

Reference DirectionComponent.

operator=()

DirectionComponent & helios::engine::modules::physics::motion::components::DirectionComponent::operator= (DirectionComponent &&)
noexcept default

Definition at line 77 of file DirectionComponent.ixx.

Reference DirectionComponent.

Public Member Functions

direction()

helios::math::vec3f helios::engine::modules::physics::motion::components::DirectionComponent::direction ()
inline nodiscard noexcept

Retrieves the stored direction vector.

Returns

The current normalized direction vector.

Definition at line 98 of file DirectionComponent.ixx.

98 [[nodiscard]] helios::math::vec3f direction() const noexcept {
99 return direction_;
100 }

Referenced by DirectionComponent and setDirection.

disable()

void helios::engine::modules::physics::motion::components::DirectionComponent::disable ()
inline noexcept

Disables this component.

Definition at line 59 of file DirectionComponent.ixx.

59 void disable() noexcept {
60 isEnabled_ = false;
61 }

enable()

void helios::engine::modules::physics::motion::components::DirectionComponent::enable ()
inline noexcept

Enables this component.

Definition at line 52 of file DirectionComponent.ixx.

52 void enable() noexcept {
53 isEnabled_ = true;
54 }

isEnabled()

bool helios::engine::modules::physics::motion::components::DirectionComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 45 of file DirectionComponent.ixx.

45 [[nodiscard]] bool isEnabled() const noexcept {
46 return isEnabled_;
47 }

setDirection()

void helios::engine::modules::physics::motion::components::DirectionComponent::setDirection (const helios::math::vec3f direction)
inline noexcept

Sets the direction vector.

The provided vector must be normalized. An assertion checks this in debug builds.

Parameters
direction

The new normalized direction vector.

Definition at line 87 of file DirectionComponent.ixx.

87 void setDirection(const helios::math::vec3f direction) noexcept {
88 assert(direction.length() - 1.0f <= helios::math::EPSILON_LENGTH
89 && "direction must be normalized");
90 direction_ = direction;
91 }

References direction, helios::math::EPSILON_LENGTH and setDirection.

Referenced by setDirection.

Private Member Attributes

direction_

helios::math::vec3f helios::engine::modules::physics::motion::components::DirectionComponent::direction_ {}

The stored normalized direction vector.

Definition at line 31 of file DirectionComponent.ixx.

31 helios::math::vec3f direction_{};

isEnabled_

bool helios::engine::modules::physics::motion::components::DirectionComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 36 of file DirectionComponent.ixx.

36 bool isEnabled_ = true;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.