group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Forces.hpp File Reference

Unified force / impulse / torque API. More...

#include "ecs/registry/Registry.hpp"
#include <glm/vec3.hpp>
Include dependency graph for Forces.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  physics
 Pure physics math — no ECS types, no registry.
namespace  physics::forces

Functions

void physics::forces::applyImpulse (Registry &registry, entt::entity entity, glm::vec3 impulse) noexcept
 Apply an instantaneous impulse (units: kg·m/s) at the entity's centre-of-mass.
void physics::forces::applyForce (Registry &registry, entt::entity entity, glm::vec3 force) noexcept
 Apply a continuous force (units: kg·m/s²) at the entity's centre.
void physics::forces::applyImpulseAtPoint (Registry &registry, entt::entity entity, glm::vec3 impulse, glm::vec3 worldPoint) noexcept
 Apply an off-centre impulse.
void physics::forces::applyForceAtPoint (Registry &registry, entt::entity entity, glm::vec3 force, glm::vec3 worldPoint) noexcept
 Apply an off-centre continuous force.
void physics::forces::applyTorque (Registry &registry, entt::entity entity, glm::vec3 torque) noexcept
 Apply a torque (Phase 7). No-op for entities without a RigidBody.
void physics::forces::integrateAccumulators (Registry &registry, float dt) noexcept
 Drain every entity's force / impulse accumulators into its velocity (and, in Phase 7, angular velocity).

Detailed Description

Unified force / impulse / torque API.

Replaces the older pattern of directly mutating a Velocity component from gameplay code (knockback, projectile bounce, explosion) with a proper accumulator path that respects per-body mass / inertia / damping.

Compatibility. Entities without a RigidBody fall back to "unit mass kinematic" semantics — applyImpulse becomes velocity += impulse exactly as the legacy code did. Phase 7 turns the player into a real rigid body with mass-aware integration; until then, the API is just a thin abstraction over the existing mutation pattern.