All projects
BabylonJS Physics 3D

HAVOK Physics Playground — BabylonJS

Browser-based 3D car demo with Havok rigid-body physics. Drive a car around a walled arena, smash pillars and balls, skid marks, particle FX, and PBR materials.

Real-time 3D car playground running entirely in the browser. Havok WASM handles rigid-body simulation — the car, destructible pillars, and 100 spawnable physics balls all interact with full collision response.

HAVOK Demo

Features

  • Havok Physics — rigid-body simulation via @babylonjs/havok WASM plugin
  • GLB Car Model — async-loaded, click to randomize paint color
  • Keyboard & Virtual Joystick — WASD/arrows on desktop; touch joystick auto-activates on mobile
  • Wheel Animation — front wheels steer, all wheels spin per velocity
  • Tire Decals — skid marks stamped on ground during cornering
  • Particle FX — smoke burst on sphere collision
  • PBR Materials — ground, walls, pillars, spheres
  • HDR Skybox — IBL from .env cube texture
  • PCF Shadows — percentage-closer filtered shadow map
  • FPS + Active Mesh counter — live stats overlay

Controls

Keyboard

KeyAction
W / Forward
S / Reverse
A / Turn left
D / Turn right

Touch

JoystickAction
Left YForward / Reverse
Right XSteer

Buttons

ButtonAction
DROP OBJECTSSpawn 100 random physics balls
CLEARRemove spawned balls

How It Works

BabylonJS Engine renders to a fullscreen canvas. HavokPhysics() loads async and enables gravity at -20 Y. Ground, 4 walls, and 10 random pillars are static PhysicsAggregate bodies (mass: 0). The car GLB wraps in an invisible physics box (mass: 100) with center of mass shifted down for stability. ArcRotateCamera tracks the car; WASD is intercepted so setLinearVelocity / setAngularVelocity drive the physics body directly. If the car falls below Y = -1, the page auto-reloads.

Tech Stack

LibraryRole
BabylonJS 9.10.x3D engine, scene, physics API
@babylonjs/havok 1.3.xHavok WASM physics plugin
babylonjs-guiVirtual joystick
babylonjs-loadersGLB/GLTF loading
Bootstrap 5UI button styling

Built by

Viseni Design Studio

3D, WebGL, interactive & VR/AR experiences

Visit viseni.com