Skip to main content

Module physics

Module physics 

Source
Expand description

Physics simulation — rigid bodies, constraints, collision, fluid dynamics.

This module provides a simplified 2D/3D physics simulation layer for Proof Engine. All physical objects are mathematical entities — their motion is derived from differential equations integrated via RK4.

§Subsystems

  • RigidBody — point masses with velocity, acceleration, forces
  • Constraint — distance, angle, hinge, weld constraints
  • Collider — circle/box/capsule shapes for broad/narrow phase
  • PhysicsWorld— simulation driver, constraint solver, broadphase
  • FluidSolver — grid-based Eulerian fluid (velocity + pressure)
  • SoftBody — mass-spring soft body meshes

All positions are in world-space float coordinates.

Re-exports§

pub use joints::Joint;
pub use joints::JointType;
pub use joints::Ragdoll;
pub use joints::RagdollBone;
pub use joints::CharacterController;
pub use joints::JointSolver;
pub use fluid::FluidGrid;
pub use soft_body::SoftBody;

Modules§

constraints
XPBD + Sequential-Impulse constraint solver for 2D/3D rigid bodies.
fluid
Eulerian grid-based fluid simulation (velocity + pressure + density).
fluids
SPH fluid simulation, height-field water, buoyancy, and fluid rendering integration.
joints
3D Physics joints, rigid bodies, collision detection, broadphase, ray casting, impulse resolution, and sleep system.
rigid_body
2D Rigid Body Physics for Proof Engine.
soft_body
Mass-spring soft body simulation.

Structs§

BodyId
Unique body identifier.
ContactManifold
Result of a collision test between two bodies.
PhysicsWorld
The physics simulation world.
RigidBody
A simulated rigid body (treated as a point mass for simplicity).

Enums§

Collider
Collision shape for a body.
Constraint
A physical constraint between two bodies.

Functions§

aabb_aabb
Test AABB vs AABB (using bounding boxes).
circle_circle
Test circle vs circle.
resolve_contact
Resolve a contact manifold by applying impulses to both bodies.
rk4_2d
Runge-Kutta 4 for a 2D position given a force function.
verlet_step
Verlet integration step (position + velocity-Verlet). More accurate than Euler for conservative forces.