Skip to main content

SteeringCommand Class

Command that updates the heading direction of a GameObject. More...

Declaration

class helios::engine::modules::physics::motion::commands::SteeringCommand { ... }

Public Constructors Index

SteeringCommand (const helios::engine::ecs::EntityHandle entityHandle, const helios::math::vec2f direction, float turnFactor)

Constructs a new SteeringCommand. More...

Public Member Functions Index

voidexecute (helios::engine::runtime::world::UpdateContext &updateContext) const noexcept

Executes the heading update on the target GameObject. More...

Private Member Attributes Index

const floatturnFactor_

The interpolation factor for the turn (0.0 to 1.0). More...

const helios::math::vec2fdirection_ {}

The target direction vector. More...

const helios::engine::ecs::EntityHandleentityHandle_

Description

Command that updates the heading direction of a GameObject.

This command encapsulates a request to change the heading (facing direction) of a GameObject. It targets the SteeringComponent and applies the specified direction and turn factor (interpolation speed).

Definition at line 28 of file SteeringCommand.ixx.

Public Constructors

SteeringCommand()

helios::engine::modules::physics::motion::commands::SteeringCommand::SteeringCommand (const helios::engine::ecs::EntityHandle entityHandle, const helios::math::vec2f direction, float turnFactor)
inline explicit

Constructs a new SteeringCommand.

Parameters
direction

The target direction vector (should be normalized).

turnFactor

The speed/interpolation factor for the turn.

Definition at line 52 of file SteeringCommand.ixx.

53 const helios::engine::ecs::EntityHandle entityHandle,
54 const helios::math::vec2f direction,
55 float turnFactor
56 ) :
57 entityHandle_(entityHandle),
58 direction_(direction),
59 turnFactor_(turnFactor)
60 {}

Public Member Functions

execute()

void helios::engine::modules::physics::motion::commands::SteeringCommand::execute (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Executes the heading update on the target GameObject.

Retrieves the SteeringComponent from the GameObject and calls setHeading() with the stored direction and turn factor. If the component is missing, the command does nothing.

Parameters
gameObject

The GameObject to apply the command to.

Definition at line 73 of file SteeringCommand.ixx.

73 void execute(helios::engine::runtime::world::UpdateContext& updateContext) const noexcept {
74
75 auto gameObject = updateContext.find(entityHandle_);
76
77 if (!gameObject) {
78 return;
79 }
80
82
83 if (hc) {
84 hc->setHeading(direction_.toVec3(), turnFactor_);
85 }
86
87 }

Private Member Attributes

direction_

const helios::math::vec2f helios::engine::modules::physics::motion::commands::SteeringCommand::direction_ {}

The target direction vector.

Definition at line 39 of file SteeringCommand.ixx.

39 const helios::math::vec2f direction_{};

entityHandle_

const helios::engine::ecs::EntityHandle helios::engine::modules::physics::motion::commands::SteeringCommand::entityHandle_

Definition at line 42 of file SteeringCommand.ixx.

42 const helios::engine::ecs::EntityHandle entityHandle_;

turnFactor_

const float helios::engine::modules::physics::motion::commands::SteeringCommand::turnFactor_

The interpolation factor for the turn (0.0 to 1.0).

Definition at line 34 of file SteeringCommand.ixx.

34 const float turnFactor_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.