group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
physics::forces Namespace Reference

Functions

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

Function Documentation

◆ applyForce()

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.

Integrated as velocity += F * dt * invMass.

Here is the caller graph for this function:

◆ applyForceAtPoint()

void physics::forces::applyForceAtPoint ( Registry & registry,
entt::entity entity,
glm::vec3 force,
glm::vec3 worldPoint )
noexcept

Apply an off-centre continuous force.

Same semantics as applyImpulseAtPoint but as a force, integrated by dt.

Here is the call graph for this function:

◆ applyImpulse()

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.

No torque component.

If the entity has RigidBody, the impulse accumulates into impulseAccum and is integrated as velocity += J * invMass at tick start. Otherwise, falls back to velocity += impulse directly.

Thread-safe iff the same entity is not modified from multiple threads in the same tick.

Here is the caller graph for this function:

◆ applyImpulseAtPoint()

void physics::forces::applyImpulseAtPoint ( Registry & registry,
entt::entity entity,
glm::vec3 impulse,
glm::vec3 worldPoint )
noexcept

Apply an off-centre impulse.

The linear component changes velocity; the angular component (lever arm × J) changes angularVelocity. Linear-only fallback for entities without a RigidBody (no rotation yet).

Parameters
worldPointWorld-space point where the impulse is applied.
Here is the call graph for this function:

◆ applyTorque()

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.

◆ integrateAccumulators()

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).

Called once per physics tick from runMovement before the integration step.

Parameters
registryECS registry.
dtTick duration (seconds).
Here is the caller graph for this function: