I'll build an interactive sonic boom / supersonic flight physics simulation. Let me first explore the project structure.
I'll build a fresh sonic boom simulation. Let me plan the physics:
The physics of a sonic boom:
- Sound propagates as spherical waves at the speed of sound (Mach 1). Each moment the jet emits a pressure wave that expands as a circle.
- When the jet flies slower than sound (subsonic), the circles nest inside each other ahead of the jet.
- At exactly Mach 1, all wavefronts pile up at the nose.
- Above Mach 1, the wavefronts form a Mach cone — the envelope tangent to all the emitted spheres. The half-angle μ satisfies sin(μ) = 1/M.
- The cone edge is the shock wave; when it sweeps past an observer, they hear the "boom."
I'll simulate this literally by emitting expanding wave circles from the jet's past positions, which naturally produces the Mach cone geometry, plus the vapor cone, shockwave sweep, and boom detection at a ground observer.
Let me create the physics engine first.
Now the canvas renderer that draws the wavefronts, Mach cone, jet, vapor cone, and boom effects.
Now the App with controls, live physics readouts, and boom feedback. I'll also add a Web Audio boom sound.
Now let me remove the old water files and update the title.
Now let me build to confirm everything compiles.
Build succeeds. Let me refine one physics detail — the dirs variable in the cone fill is unused-ish and the interpolation t uses dt in a slightly off way. Let me verify the emission interpolation and clean up the unused mMachangle import edge. Let me check the cone rendering more carefully.
The cone rendering is correct. The build passed, so everything is functional. The simulation is complete.
Sonic Boom — Supersonic Flight Physics Simulation
I replaced the previous project with a physically-grounded sonic boom simulation. Here's what it does and the physics behind it:
The core physics (src/sonic.ts)
The simulation is emergent, not faked. The jet continuously emits spherical pressure waves that expand outward at the speed of sound (radius = c × age). Everything else follows naturally:
- Subsonic (M < 1): the jet never catches its waves — circles nest ahead of it, no shock.
- Transonic (M ≈ 1): all wavefronts stack up at the nose — the "sound barrier."
- Supersonic (M > 1): the jet outruns its own sound; the common tangent to every wavefront forms the Mach cone, whose half-angle obeys sin μ = 1/M. The cone edge is the shock wave.
Visuals (src/SonicCanvas.tsx)
- Live expanding wavefront circles (the raw physics)
- The Mach cone shock envelope with bright shock edges and a live μ angle label
- A vapor/condensation cone that appears around the jet near and above Mach 1
- A ground observer — when the shock cone sweeps past it, a boom flash fires
- Hand-drawn jet with afterburner glow, sky gradient, ground line
Interaction & feedback (src/App.tsx)
- Mach slider (0.4–3.0) with a color gradient from subsonic→supersonic, plus preset buttons (M 0.8, 1.0, 1.6, 2.0)
- Live readout panel: regime, Mach number, Mach angle μ, and a booms-heard counter
- Toggles for wavefronts, Mach cone, and sound, plus pause and restart pass
- A synthesized boom (
src/boomAudio.ts) — filtered noise with a double-crack attack and low rumble decay, triggered exactly when the shock reaches the observer (only when supersonic)
Try dragging the Mach slider from subsonic up past 1.0 to watch the nested circles collapse into a shock at the nose, then form a trailing cone that narrows as speed increases — and listen for the boom each time the jet's shock sweeps the observer on the ground.
Files built: src/sonic.ts, src/SonicCanvas.tsx, src/boomAudio.ts, src/App.tsx, index.html