|
group2 0.1.0
CSE 125 Group 2
|
Unified force / impulse / torque API. More...
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 ®istry, 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 ®istry, 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 ®istry, entt::entity entity, glm::vec3 impulse, glm::vec3 worldPoint) noexcept |
| Apply an off-centre impulse. | |
| void | physics::forces::applyForceAtPoint (Registry ®istry, entt::entity entity, glm::vec3 force, glm::vec3 worldPoint) noexcept |
| Apply an off-centre continuous force. | |
| void | physics::forces::applyTorque (Registry ®istry, entt::entity entity, glm::vec3 torque) noexcept |
| Apply a torque (Phase 7). No-op for entities without a RigidBody. | |
| void | physics::forces::integrateAccumulators (Registry ®istry, float dt) noexcept |
| Drain every entity's force / impulse accumulators into its velocity (and, in Phase 7, angular velocity). | |
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.