Simulation & Devlog

Explore the engineering behind the Rapier3D physics engine and Three.js renderer.

๐Ÿ“– Physics Engine Deep Dive โ†— ๐Ÿ  Home & Projects โ†—

Credits

Built by @dpwxni ๐•
Race Engineer Simulator

Formula 1 Browser Racing & Physics Engine

A real-time 3D Formula 1 simulator built with Three.js and Rapier3D (WebAssembly). Map suspension stiffness, tire compounds, and aero downforce directly to real-world motorsport dynamics right in your browser.

How the Vehicle Physics Works

Unlike arcade games with scripted drift physics, this simulator utilizes a true Raycast Vehicle Controller powered by Rapier3D (WASM). In a raycast vehicle model, the car's monocoque is represented as an 800 kg rigid body, while four downward rays measure road clearance at 60 Hz to compute instantaneous suspension travel and contact patch forces.

Hooke's Law Suspension

Calculates spring compression and damping rates per wheel to prevent bottoming out across curbs while maintaining high-speed chassis stability.

Tire Friction Circle

Models lateral cornering grip vs. longitudinal braking and acceleration. Soft compounds yield higher peak grip with sharper thermal degradation.

Aerodynamic Downforce

Generates downward force proportional to velocity squared (vยฒ), pressing the tires into the track at high speeds while inducing drag on long straights.

Controls & Driving Mechanics

Desktop Controls:
  • W or โ†‘ : Throttle / Acceleration
  • S or โ†“ : Brakes / Reverse
  • A / D or โ† / โ†’ : Steering
  • Space : Handbrake / E-Brake
Mobile Controls:

On touch devices, an on-screen interactive Formula 1 steering wheel enables analog-style cornering alongside dedicated accelerator and brake pedals.

The 3D Garage & Telemetry

Click the ๐ŸŽ๏ธ Garage button to inspect the chassis, adjust suspension stiffness, change tire compounds between soft, medium, and hard, and fine-tune your aerodynamic balance before setting a hot lap.

Read the full Engineering Deep Dive & Devlog โ†’
Crafted by @dpwxni ยท dipakwani.com