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 { ... }

Base class

classTargetedCommand

Abstract base class for commands targeting a specific GameObject. More...

Public Constructors Index

SteeringCommand (const helios::math::vec2f direction, float turnFactor)

Constructs a new SteeringCommand. More...

Public Member Functions Index

voidexecute (helios::engine::ecs::GameObject gameObject) const noexcept override

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...

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 25 of file SteeringCommand.ixx.

Public Constructors

SteeringCommand()

helios::engine::modules::physics::motion::commands::SteeringCommand::SteeringCommand (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 46 of file SteeringCommand.ixx.

47 const helios::math::vec2f direction,
48 float turnFactor
49 ) :
50 direction_(direction),
51 turnFactor_(turnFactor)
52 {}

Public Member Functions

execute()

void helios::engine::modules::physics::motion::commands::SteeringCommand::execute (helios::engine::ecs::GameObject gameObject)
inline noexcept virtual

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 65 of file SteeringCommand.ixx.

65 void execute(helios::engine::ecs::GameObject gameObject) const noexcept override {
66
68
69 if (hc) {
70 hc->setHeading(direction_.toVec3(), turnFactor_);
71 }
72
73 }

Private Member Attributes

direction_

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

The target direction vector.

Definition at line 36 of file SteeringCommand.ixx.

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

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 31 of file SteeringCommand.ixx.

31 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.