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.modules.physics.motion.components.Move2DComponent>
#include <helios.engine.common.tags.SystemRole>
#include <helios.engine.runtime.world.GameWorld>
#include <helios.math>
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:
29export namespace helios::engine::modules::physics::motion::systems {
45 class Move2DSystem {
64 [[nodiscard]] static helios::math::vec3f moveGameObject(
66 helios::math::vec3f currentDirection,
74 return helios::math::vec3f{0.0f};
77 bool movementStateChanged = cmp->throttle() > helios::math::EPSILON_LENGTH;
80 auto velocity = cmp->velocity();
83 float movementDampening = cmp->movementDampening();
90 if (velocity.length() <= helios::math::EPSILON_LENGTH) {
96 if (cmp->useInstantAcceleration()) {
97 velocity = currentDirection * cmp->movementSpeed() * cmp->throttle();
101 velocity = velocity + (currentDirection * (cmp->movementAcceleration() * cmp->throttle() * deltaTime));
107 if (velocity.length() > cmp->movementSpeed()) {
108 velocity = velocity.normalize() * cmp->movementSpeed();
111 cmp->setVelocity(velocity);
113 return (velocity + cmp->inheritedVelocity()) * deltaTime;
128 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept {
137 helios::math::vec3f translationDelta;
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.