Skip to main content

SteeringCommand.ixx File

Command for updating the heading of a GameObject. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemodules

Domain-specific components and systems. More...

namespacephysics

Physics simulation and collision detection subsystem for the game engine. More...

namespacemotion

Motion physics components and systems. More...

namespacecommands

Classes Index

classSteeringCommand

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

Description

Command for updating the heading of a GameObject.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file SteeringCommand.ixx
3 * @brief Command for updating the heading of a GameObject.
4 */
5module;
6
7export module helios.engine.modules.physics.motion.commands.SteeringCommand;
8
9import helios.engine.runtime.messaging.command.TargetedCommand;
10import helios.engine.ecs.GameObject;
11import helios.math.types;
12import helios.engine.modules.physics.motion.components.SteeringComponent;
13
15
16
17 /**
18 * @brief Command that updates the heading direction of a GameObject.
19 *
20 * @details
21 * This command encapsulates a request to change the heading (facing direction)
22 * of a GameObject. It targets the SteeringComponent and applies the specified
23 * direction and turn factor (interpolation speed).
24 */
26
27
28 /**
29 * @brief The interpolation factor for the turn (0.0 to 1.0).
30 */
31 const float turnFactor_;
32
33 /**
34 * @brief The target direction vector.
35 */
36 const helios::math::vec2f direction_{};
37
38 public:
39
40 /**
41 * @brief Constructs a new SteeringCommand.
42 *
43 * @param direction The target direction vector (should be normalized).
44 * @param turnFactor The speed/interpolation factor for the turn.
45 */
47 const helios::math::vec2f direction,
48 float turnFactor
49 ) :
50 direction_(direction),
51 turnFactor_(turnFactor)
52 {}
53
54
55 /**
56 * @brief Executes the heading update on the target GameObject.
57 *
58 * @details
59 * Retrieves the SteeringComponent from the GameObject and calls setHeading()
60 * with the stored direction and turn factor. If the component is missing,
61 * the command does nothing.
62 *
63 * @param gameObject The GameObject to apply the command to.
64 */
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 }
74
75 };
76
77
78}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.