LevelBoundsBehaviorSystem.ixx File
System for handling entity behavior at level boundaries. More...
Included Headers
#include <cassert>
#include <helios.engine.common.tags.SystemRole>
#include <helios.engine.mechanics.lifecycle.components.Active>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.runtime.spawn.commands.DespawnCommand>
#include <helios.engine.ecs.View>
#include <helios.engine.modules.scene.components.SceneNodeComponent>
#include <helios.engine.modules.rendering.model.components.ModelAabbComponent>
#include <helios.engine.modules.spatial.transform.components.RotationStateComponent>
#include <helios.engine.mechanics.spawn.components.SpawnedByProfileComponent>
#include <helios.engine.modules.physics.collision.components.AabbColliderComponent>
#include <helios.math>
#include <helios.engine.mechanics.bounds.components.LevelBoundsBehaviorComponent>
#include <helios.engine.runtime.messaging.command.EngineCommandBuffer>
#include <helios.engine.modules.physics.collision.types.CollisionBehavior>
#include <helios.engine.state.Bindings>
#include <helios.engine.modules.physics.collision.types.CollisionResponse>
#include <helios.engine.modules.physics.motion.components.Move2DComponent>
#include <helios.engine.ecs.GameObject>
#include <helios.scene.SceneNode>
#include <helios.engine.modules.physics.motion.components.SteeringComponent>
#include <helios.engine.modules.spatial.transform.components.ComposeTransformComponent>
#include <helios.engine.runtime.world.GameWorld>
#include <helios.engine.modules.spatial.transform.components.TranslationStateComponent>
#include <helios.engine.modules.physics.motion.components.DirectionComponent>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | mechanics |
|
High-level gameplay systems and components for game logic. More... | |
| namespace | bounds |
| namespace | systems |
|
Boundary detection and response systems. More... | |
Classes Index
| class | LevelBoundsBehaviorSystem |
|
System that handles entity behavior when colliding with level boundaries. More... | |
| struct | BounceResult |
|
Result of a bounce calculation against level bounds. More... | |
Description
System for handling entity behavior at level boundaries.
File Listing
The file content with the documentation metadata removed is:
48export namespace helios::engine::mechanics::bounds::systems {
58 class LevelBoundsBehaviorSystem {
69 helios::math::vec3f translation;
71 helios::math::vec3f velocity;
73 helios::math::vec3f direction;
90 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept {
92 using namespace helios::engine::modules::physics::collision::types;
111 helios::math::mat4f parentWorldTransform = sc->sceneNode()->parent()->worldTransform();
112 helios::math::vec4f childWorldTranslation = parentWorldTransform * tsc->translation().toVec4(1.0f);
114 helios::math::vec3f bouncedWorldTranslation;
118 if (bbc->collisionBehavior() == CollisionBehavior::Reflect || bbc->collisionBehavior() == CollisionBehavior::Bounce) {
121 childWorldTranslation.toVec3(), objectBounds, levelBounds,
122 bbc->collisionBehavior() == CollisionBehavior::Reflect ? 1.0f : bbc->restitution(),
129 } else if (bbc->collisionBehavior() == CollisionBehavior::Despawn) {
133 auto* sbp = entity.get<helios::engine::mechanics::spawn::components::SpawnedByProfileComponent>();
136 updateContext.queueCommand<helios::engine::runtime::spawn::commands::DespawnCommand>(
148 auto parentTransform_inverse = parentWorldTransform.inverse();
149 auto childLocalTranslation = parentTransform_inverse * bouncedWorldTranslation.toVec4(1.0f);
153 parentWorldTransform.withTranslation(bouncedWorldTranslation)
174 helios::engine::ecs::GameObject go,
176 helios::engine::modules::physics::collision::types::CollisionResponse collisionResponse) {
178 if (collisionResponse == helios::engine::modules::physics::collision::types::CollisionResponse::AlignHeadingToDirection) {
179 auto* psc = go.get<helios::engine::modules::physics::motion::components::SteeringComponent>();
210 helios::math::vec3f worldTranslation,
211 helios::math::aabbf objectBounds,
212 helios::math::aabbf levelBounds,
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.