Brine2D.Systems.Physics Namespace
Definition¶
Namespace: Brine2D.Systems
| Classes | |
|---|---|
| Box2DDebugDrawSystem | |
| Box2DPhysicsSystem | Fixed-update system that drives Box2D simulation. Each step: 1. Tears down bodies for disabled entities (flushing their contact state). 2. Flushes contact/sensor state for bodies whose simulation was disabled this tick. 3. Syncs dirty PhysicsBodyComponent data → Box2D bodies/shapes. 4. Applies lightweight filter updates for layer/mask-only changes on live bodies. 5. Applies lightweight body-type changes via B2.BodySetType (no full rebuild). 6. Applies lightweight material updates (friction, restitution, hit-events) on live bodies. 7. Applies GravityOverride forces to dynamic bodies. 8. Pushes ECS transforms for kinematic bodies into Box2D (derives linear + angular velocity from displacement). 9. Syncs joint components → Box2D joints. 10. Installs or removes the system collision filter only when at least one body or sub-shape has a ShouldCollide or ShouldCollide predicate. 11. Steps the Box2D world. 12. Reads back body positions/rotations into ECS transforms. 13. Dispatches collision, sensor, hit, and sleep/wake events. 14. Checks joint break thresholds and fires OnBreak as needed. |
| BuoyancySystem | Applies buoyancy, drag, and flow forces to dynamic bodies overlapping any BuoyancyZoneComponent trigger each fixed-update pre-physics tick. Registered automatically by AddPhysics(). |
| KinematicCharacterSystem | Drives KinematicCharacterBody components each fixed-update tick. Register two instances in DI — one at PrePhysics (pre-step: slides velocity, carries platform motion, integrates position) and one at PostPhysics (post-step: classifies contacts, updates grounded state, snaps to floor, tracks moving platform). Both instances are registered automatically by AddPhysics(). Add both to a scene with world.AddSystem<KinematicCharacterSystem>(). |
| PostPhysicsKinematicCharacterSystem | Post-physics instance of KinematicCharacterSystem. Registered separately in DI so both the pre- and post-step instances can be resolved via AddSystem without DI type-key collisions. |
| PrePhysicsKinematicCharacterSystem | Pre-physics instance of KinematicCharacterSystem. Registered separately in DI so both the pre- and post-step instances can be resolved via AddSystem without DI type-key collisions. |