I have built PHYSX 2D, an interactive 2D physics playground filled with rich physics phenomena and powerful mouse tools!
🌟 Physics Phenomena & Presets Included
- 🌌 Black Hole Singularity: A central supermassive black hole bending space-time trajectories, pulling orbiting planets and space dust into spinning accretion disks with event horizon gravitational forces.
- 💥 Brittle Glass Shatter & Demolition: Dynamic Voronoi glass pane towers that fracture into glass shards on high-velocity impact from swinging wrecking balls or laser slashes.
- 🌀 Quantum Portal Teleportation: Linked Portal Pair (Orange & Blue) that teleports rigid bodies, rubber balls, and fluid streams preserving local momentum and velocity vectors.
- 🌊 SPH Fluid Dynamics & Buoyancy: Smoothed Particle Hydrodynamics solver simulating fluid pressure, viscosity, and surface tension with floating wooden crates and rubber ducks.
- 🧘 Squishy Slimes & Ragdoll Physics: Soft-body pressure-based jellies and interactive ragdolls tumbling down pinball bumpers.
- ⚡ Electromagnetic Plasma Arcs: Electrostatic attraction/repulsion between (+ / -) charged spheres with plasma lightning arcs firing across close bodies.
- 🧵 Ninja Cloth Mesh & Rope Slicer: Multi-layer hanging cloth fabrics and ropes that can be sliced up with the laser scalpel tool.
- 🪜 Domino Rally Extravaganza: Curved domino line rallies with ball triggers ending in explosive barrel chain reactions.
- 🪐 Solar System Orbital Slingshot: Keplerian N-body multi-gravitational system with live trajectory path tracing.
- 🎯 Chaotic Double Pendulum & Newton's Cradle: A chaotic double pendulum tracing fractal trajectory paths alongside a high-restitution Newton's cradle.
🛠️ Sick Mouse Tools & Interactions
- 🖐️ Grab & Sling: Drag, fling, and throw objects with spring force elasticity.
- 🔫 Gravity Gun / Tractor Beam: Lock target objects, levitate them in mid-air force fields, and fire them with high impulse!
- 💥 Shockwave Impulse: Click or drag to trigger explosive shockwave rings that blast bodies and particles away.
- 🕳️ Singularity Mouse: Hold click to summon a miniature black hole wherever your mouse points.
- 💧 Fluid Hose: Continuous stream of viscous fluid drops spewing towards pointer angle.
- ✂️ Laser Scalpel Slicer: Draw cutting lines across the canvas to slice constraints, ropes, cloth meshes, and glass panes.
- ⚡ Plasma Arc Gun: Shoot bolts at target objects to charge them electrically.
- ✏️ Draw Static Ramp / Wall: Freehand draw solid ramps, bowls, and pinball terrain directly on canvas.
- ➕ Spawner Wheel & Palette: Spawn Circles, Boxes, Polygons, Glass Panes, Explosive Barrels, Bouncy Bumpers, Ragdolls, and Singularity Cores.
🎛️ Engine Features & Web Audio FX
- 🔊 Procedural Web Audio Synthesizer: Generates dynamic collision impacts (metal ping, heavy thud, glass shatter, fluid splash, portal swoosh, electric zaps, gravity gun blasts, explosions).
- ⏳ Time Reversal Matrix (10s Rewind): Records a rolling frame history buffer so you can hit Rewind to play back past physics interactions!
- 🔍 Object Inspector: Click any body in the scene to tweak its color, mass, charge, bounciness, brittle glass mode, or scale and duplicate it!
- ⚙️ Environment Sliders: Control Gravity X/Y (Zero-G, Inverted, Earth), Restitution, Surface Friction, Wind, SPH Fluid Viscosity, Motion Trails, Velocity Vectors, and Particle Glow overlays.
Files built: index.html, src/index.css, src/types/physics.ts, src/utils/audio.ts, src/physics/presets.ts, src/physics/engine.ts, src/components/CanvasPlayground.tsx, src/components/TopBar.tsx, src/components/Toolbar.tsx, src/components/SettingsPanel.tsx, src/components/InspectorModal.tsx, src/components/HelpModal.tsx, src/App.tsx