Skip to main content

LevelBoundsBehaviorComponent Class

Component that defines how an entity reacts to level boundaries. More...

Declaration

class helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent { ... }

Public Constructors Index

LevelBoundsBehaviorComponent (const float restitution)

Constructs a LevelBoundsBehaviorComponent with a specified restitution. More...

LevelBoundsBehaviorComponent (const helios::engine::modules::physics::collision::types::CollisionBehavior collisionBehavior=helios::engine::modules::physics::collision::types::CollisionBehavior::Reflect, const helios::engine::modules::physics::collision::types::CollisionResponse collisionResponse=helios::engine::modules::physics::collision::types::CollisionResponse::None)

Constructs a LevelBoundsBehaviorComponent with a specified collision behavior. More...

LevelBoundsBehaviorComponent (const LevelBoundsBehaviorComponent &other)

Copy constructor. More...

LevelBoundsBehaviorComponent (LevelBoundsBehaviorComponent &&) noexcept=default

Public Operators Index

LevelBoundsBehaviorComponent &operator= (const LevelBoundsBehaviorComponent &)=default
LevelBoundsBehaviorComponent &operator= (LevelBoundsBehaviorComponent &&) 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...

floatrestitution () const noexcept

Retrieves the restitution coefficient. More...

helios::engine::modules::physics::collision::types::CollisionBehaviorcollisionBehavior () const noexcept

Retrieves the collision behavior type. More...

helios::engine::modules::physics::collision::types::CollisionResponsecollisionResponse () const noexcept

Retrieves the collision response type. More...

voidsetCollisionResponse (const helios::engine::modules::physics::collision::types::CollisionResponse collisionResponse) noexcept

Sets the collision response type. More...

voidsetCollisionBehavior (const helios::engine::modules::physics::collision::types::CollisionBehavior collisionBehavior) noexcept

Sets the collision behavior type. More...

voidsetRestitution (const float restitution) noexcept

Sets the coefficient of restitution (bounciness). More...

Private Member Attributes Index

floatrestitution_ = 0.5f

Coefficient of restitution (bounciness). More...

helios::engine::modules::physics::collision::types::CollisionBehaviorcollisionBehavior_ = helios::engine::modules::physics::collision::types::CollisionBehavior::Bounce

The behavior type for boundary collisions. More...

helios::engine::modules::physics::collision::types::CollisionResponsecollisionResponse_ = helios::engine::modules::physics::collision::types::CollisionResponse::None
boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that defines how an entity reacts to level boundaries.

This component stores properties related to boundary interactions, such as restitution (bounciness) when colliding with level walls, used by physics or movement systems to resolve out-of-bounds conditions.

Definition at line 29 of file LevelBoundsBehaviorComponent.ixx.

Public Constructors

LevelBoundsBehaviorComponent()

helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::LevelBoundsBehaviorComponent (const float restitution)
inline explicit

Constructs a LevelBoundsBehaviorComponent with a specified restitution.

Parameters
restitution

The coefficient of restitution (0.0 to 1.0).

Definition at line 87 of file LevelBoundsBehaviorComponent.ixx.

88 restitution_(restitution) {}

Reference restitution.

Referenced by LevelBoundsBehaviorComponent, LevelBoundsBehaviorComponent, operator= and operator=.

LevelBoundsBehaviorComponent()

LevelBoundsBehaviorComponent()

helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::LevelBoundsBehaviorComponent (const LevelBoundsBehaviorComponent & other)
inline

Copy constructor.

Parameters
other

The component to copy from.

Definition at line 107 of file LevelBoundsBehaviorComponent.ixx.

108 restitution_(other.restitution_),
109 collisionBehavior_(other.collisionBehavior_),
110 collisionResponse_(other.collisionResponse_)
111 {}

Reference LevelBoundsBehaviorComponent.

LevelBoundsBehaviorComponent()

helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::LevelBoundsBehaviorComponent (LevelBoundsBehaviorComponent &&)
noexcept default

Definition at line 114 of file LevelBoundsBehaviorComponent.ixx.

Reference LevelBoundsBehaviorComponent.

Public Operators

operator=()

LevelBoundsBehaviorComponent & helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::operator= (const LevelBoundsBehaviorComponent &)
default

Definition at line 113 of file LevelBoundsBehaviorComponent.ixx.

Reference LevelBoundsBehaviorComponent.

operator=()

LevelBoundsBehaviorComponent & helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::operator= (LevelBoundsBehaviorComponent &&)
noexcept default

Definition at line 115 of file LevelBoundsBehaviorComponent.ixx.

Reference LevelBoundsBehaviorComponent.

Public Member Functions

collisionBehavior()

helios::engine::modules::physics::collision::types::CollisionBehavior helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::collisionBehavior ()
inline nodiscard noexcept

Retrieves the collision behavior type.

Returns

The collision behavior (e.g., Bounce, Reflect, Clamp, Despawn).

Definition at line 131 of file LevelBoundsBehaviorComponent.ixx.

132 return collisionBehavior_;
133 }

Referenced by LevelBoundsBehaviorComponent and setCollisionBehavior.

collisionResponse()

helios::engine::modules::physics::collision::types::CollisionResponse helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::collisionResponse ()
inline nodiscard noexcept

Retrieves the collision response type.

Returns

The collision response type (e.g., None, Event).

Definition at line 140 of file LevelBoundsBehaviorComponent.ixx.

141 return collisionResponse_;
142 }

Referenced by LevelBoundsBehaviorComponent and setCollisionResponse.

disable()

void helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::disable ()
inline noexcept

Disables this component.

Definition at line 78 of file LevelBoundsBehaviorComponent.ixx.

78 void disable() noexcept {
79 isEnabled_ = false;
80 }

enable()

void helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::enable ()
inline noexcept

Enables this component.

Definition at line 71 of file LevelBoundsBehaviorComponent.ixx.

71 void enable() noexcept {
72 isEnabled_ = true;
73 }

isEnabled()

bool helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 64 of file LevelBoundsBehaviorComponent.ixx.

64 [[nodiscard]] bool isEnabled() const noexcept {
65 return isEnabled_;
66 }

restitution()

float helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::restitution ()
inline nodiscard noexcept

Retrieves the restitution coefficient.

Returns

The restitution value.

Definition at line 122 of file LevelBoundsBehaviorComponent.ixx.

122 [[nodiscard]] float restitution() const noexcept {
123 return restitution_;
124 }

Reference restitution.

Referenced by LevelBoundsBehaviorComponent, restitution and setRestitution.

setCollisionBehavior()

void helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::setCollisionBehavior (const helios::engine::modules::physics::collision::types::CollisionBehavior collisionBehavior)
inline noexcept

Sets the collision behavior type.

Parameters
collisionBehavior

The new collision behavior to set.

Definition at line 158 of file LevelBoundsBehaviorComponent.ixx.

Reference collisionBehavior.

setCollisionResponse()

void helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::setCollisionResponse (const helios::engine::modules::physics::collision::types::CollisionResponse collisionResponse)
inline noexcept

Sets the collision response type.

Parameters
collisionResponse

The new collision response to set.

Definition at line 149 of file LevelBoundsBehaviorComponent.ixx.

Reference collisionResponse.

setRestitution()

void helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::setRestitution (const float restitution)
inline noexcept

Sets the coefficient of restitution (bounciness).

Parameters
restitution

The new restitution value to set. Must be within the range [0.0, 1.0]. Values outside this range will be clamped.

Definition at line 168 of file LevelBoundsBehaviorComponent.ixx.

168 void setRestitution(const float restitution) noexcept {
169 assert(restitution >= 0.0f && restitution <= 1.0f && "Unexpected value for restitution");
170 restitution_ = std::clamp(restitution, 0.0f, 1.0f);
171 }

Reference restitution.

Private Member Attributes

collisionBehavior_

helios::engine::modules::physics::collision::types::CollisionBehavior helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::collisionBehavior_ = helios::engine::modules::physics::collision::types::CollisionBehavior::Bounce

The behavior type for boundary collisions.

Defines how the entity reacts when hitting level bounds (e.g., Bounce, Reflect, Clamp, Despawn).

Definition at line 48 of file LevelBoundsBehaviorComponent.ixx.

collisionResponse_

helios::engine::modules::physics::collision::types::CollisionResponse helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::collisionResponse_ = helios::engine::modules::physics::collision::types::CollisionResponse::None

isEnabled_

bool helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 55 of file LevelBoundsBehaviorComponent.ixx.

55 bool isEnabled_ = true;

restitution_

float helios::engine::mechanics::bounds::components::LevelBoundsBehaviorComponent::restitution_ = 0.5f

Coefficient of restitution (bounciness).

A value of 1.0 means a perfectly elastic collision (no energy lost). A value of 0.0 means a perfectly inelastic collision (no bounce). Default is 0.5.

Definition at line 40 of file LevelBoundsBehaviorComponent.ixx.

40 float restitution_ = 0.5f;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.