How the-applicable/physics-engine works
This is a browser-based physics simulation: users configure and populate a 3D scene, then observe a C++ physics engine run through WebAssembly. The graph separates the React interface and controls, scene/input responsibilities, and native simulation internals. The sampled source shows App wiring and parts of the C++ engine; PhysicsScene and Sidebar implementation details were not sampled, so their internal relationships are limited to explicit README documentation.
Main entry points: engine.cpp Physics world API · App.tsx App orchestration · CollisionDetector.h Collision detection · ContactResolver.h Contact resolution
Components 17
Application UI
- App orchestration
src/App.tsx - Simulation controls
src/components/Sidebar.tsx
Scene and Input
- 3D physics scene
src/components/PhysicsScene.tsx - Keyboard input
src/components/KeyboardHandler.tsx - Gamepad input
src/components/GamepadHandler.tsx - Mouse interaction
src/components/MouseHandler.tsx
WebAssembly Runtime
- WASM loader
public/wasm/physics.js - Physics WASM module
public/wasm/physics.wasm
Physics Engine
- Physics world API
src/physics/engine.cpp - Rigid body dynamics
src/physics/core/RigidBody.h - Collision detection
src/physics/core/CollisionDetector.h - Contact resolution
src/physics/core/ContactResolver.h - Body constraints
src/physics/core/Constraint.h - Contact data
src/physics/core/Contact.h - Collision geometry
src/physics/geometry - Vector math
src/physics/core/Vector3.h
Other components
- User
Connections 15
- User → App orchestration: uses
- App orchestration → Simulation controls: renders controls
src/App.tsx - App orchestration → 3D physics scene: renders scene
src/App.tsx - App orchestration → WASM loader: loads module
src/App.tsx - 3D physics scene → Physics world API: uses physics API
README.md - WASM loader → Physics WASM module: loads binary
public/wasm/physics.js - Physics world API → Rigid body dynamics: creates and updates
src/physics/engine.cpp - Physics world API → Collision detection: checks collisions
src/physics/engine.cpp - Physics world API → Contact resolution: creates contacts
src/physics/engine.cpp - Physics world API → Contact resolution: resolves contacts
src/physics/engine.cpp - Physics world API → Contact resolution: resolves via
src/physics/engine.cpp - Physics world API → Body constraints: resolves constraints
src/physics/engine.cpp - Collision detection → Collision geometry: tests shapes
src/physics/core/CollisionDetector.h - Collision detection → Contact data: fills contact
src/physics/core/CollisionDetector.h - Physics world API → Vector math: uses vectors
src/physics/engine.cpp