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

Per-tick orchestration of the rigid-body dynamics pipeline. More...

Include dependency graph for DynamicsSystem.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  systems
 Client-only input sampling system — split into two halves so mouse look can run every iterate() (smooth camera at any FPS) while movement keys run once per physics tick group (server-consistent).

Functions

void systems::runDynamics (Registry &registry, float dt, const physics::WorldGeometry &world, physics::ContactCache &cache, const physics::SolverConfig &solverCfg, const physics::SleepConfig &sleepCfg)
 One physics tick for rigid-body dynamic entities.

Detailed Description

Per-tick orchestration of the rigid-body dynamics pipeline.

Sits alongside the existing kinematic runCollision for the player: while runCollision does swept-AABB resolution against the static world for entities with Position+Velocity+CollisionShape+PlayerVisState, runDynamics runs the full PGS solver pipeline for entities that have a RigidBody component (ragdoll bones, dropped weapons, dynamic debris).

Tick sequence (called from ServerGame::iterate and client prediction):

  1. Integrate position from velocity for every awake dynamic body.
  2. Generate contact manifolds vs. static world geometry (per-body swept AABB against the active world).
  3. Solve contacts (PGS) and joints (point + hinge + cone-twist).
  4. Update sleep state from converged velocities.
  5. End-of-frame: ContactCache::endFrame() reaps stale manifolds.

All systems are deterministic — pairs and joints iterated in sorted-by- entity-id order; thread-local accumulators in the events/debug paths.