Move2DSystem.ixx File
System for processing 2D movement physics. More...
Included Headers
#include <algorithm>
#include <cassert>
#include <cmath>
#include <helios.engine.mechanics.lifecycle.components.Active>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.modules.physics.motion.components.DirectionComponent>
#include <helios.engine.modules.spatial.transform.components.TranslationStateComponent>
#include <helios.engine.runtime.world.GameWorld>
#include <helios.math>
#include <helios.engine.modules.physics.motion.components.Move2DComponent>
#include <helios.engine.ecs.System>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | modules |
|
Domain-specific components and systems. More... | |
| namespace | physics |
|
Physics simulation and collision detection subsystem for the game engine. More... | |
| namespace | motion |
|
Motion physics components and systems. More... | |
| namespace | systems |
Classes Index
| class | Move2DSystem |
|
System that processes 2D movement for entities. More... | |
Description
System for processing 2D movement physics.
File Listing
The file content with the documentation metadata removed is:
27export namespace helios::engine::modules::physics::motion::systems {
43 class Move2DSystem : public helios::engine::ecs::System {
62 [[nodiscard]] static helios::math::vec3f moveGameObject(
64 helios::math::vec3f currentDirection,
72 return helios::math::vec3f{0.0f};
75 bool movementStateChanged = cmp->throttle() > helios::math::EPSILON_LENGTH;
78 auto velocity = cmp->velocity();
81 float movementDampening = cmp->movementDampening();
88 if (velocity.length() <= helios::math::EPSILON_LENGTH) {
94 if (cmp->useInstantAcceleration()) {
95 velocity = currentDirection * cmp->movementSpeed() * cmp->throttle();
99 velocity = velocity + (currentDirection * (cmp->movementAcceleration() * cmp->throttle() * deltaTime));
105 if (velocity.length() > cmp->movementSpeed()) {
106 velocity = velocity.normalize() * cmp->movementSpeed();
109 cmp->setVelocity(velocity);
111 return (velocity + cmp->inheritedVelocity()) * deltaTime;
121 void init(helios::engine::runtime::world::GameWorld& gameWorld) noexcept override {
133 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept override {
135 for (auto [entity, m2d, dc, tsc, active] : gameWorld_->view<
142 helios::math::vec3f translationDelta;
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.