Appearance
Getting started
Skidpad is a TypeScript package backed by a WebAssembly core. You never need a Rust toolchain to use it.
Install
Install @skidpad/core and, for reference vehicles, @skidpad/presets. If your bundler has trouble serving the separate .wasm file, import from @skidpad/core/compat instead; it inlines the module.
Drive a car in Node
- Call
init()once and keep the result. - Create a world with room for the vehicles you need.
- Add a vehicle from a preset or your own definition. Partial definitions are fine; missing fields take the core defaults.
- Each frame, write the input and call
step(dt)with your host step. - Read telemetry by channel name.
The repository's examples/headless-node folder has the complete script; it is under twenty lines.
Drive a car in a Three.js or R3F scene
The sandbox in apps/sandbox is the reference integration. The pattern is:
- Keep a fixed 60 Hz accumulator in your frame loop and call
step(1/60)for each accumulated step. The core substeps at 1 kHz internally. - Read
PosX,PosY,PosZand theQuat*channels to place the body, and per wheelWheelSteer_*,SuspTravel_*andSpinAngle_*to place the wheels. The core uses ISO axes (x forward, y left, z up); map them to your renderer's convention once, in one place. The sandbox maps core(x, y, z)to three.js(x, z, −y). - Feed inputs through
@skidpad/inputso keyboard, gamepad, and wheel all produce the same normalised frame. - For sound,
EngineRpm,ThrottleEffectiveandGeardrive the engine note, and per wheelPeakSlip_*(combined slip relative to the tire's peak: above 1 the tire is sliding),WheelContact_*andSurfaceId_*drive squeal and surface noise.TireFmax_*is each tire's friction limit.sp.telemetryLayoutlists every channel with its unit, andWHEEL_ORDERthe wheel suffixes.
The built-in host integrates the chassis on flat ground. To drive on real geometry, let a Rapier body be the car: see Driving a Rapier body.
Where to go next
- Vehicle definitions: the data format.
- Driving a Rapier body: the host adapter.
- Determinism contract: what is and is not guaranteed.
- Concepts: the physics, with interactive explainers.