Skip to content

jolt-ts

The power of Jolt Physics, with an API that feels like TypeScript. Semantic handles, plain-JS vectors, and no manual destroy() in sight.

Drag to orbit · scroll to zoom

Loading physics…
A live jolt-ts world running in your browser — rendered with three.js, no build step required.

Jolt Physics is a fast, modern, deterministic rigid-body engine, and JoltPhysics.js exposes almost all of it to the web. But that binding also leaks C++ rules into JavaScript: manual destroy(), AddRef()/Release(), and mutable WASM Vec3 objects everywhere.

jolt-ts wraps that raw layer in an ergonomic, TypeScript-first API — while keeping the full engine one .raw away.

Semantic, disposable ownership

world.dispose() releases the whole world. No hand-written Jolt.destroy(), AddRef(), or Release() on the common path.

Plain JS in, plain JS out

Pass [x, y, z], typed arrays, or { x, y, z }. Read back plain objects — or into caller-owned buffers for hot loops.

Owns its WASM build

Ships every Jolt build variant, compiled with cross-platform determinism on. The default wasm-compat build embeds the WASM — no asset plumbing.

Networking-ready

Binary scene snapshots plus saveState()/restoreState() for rollback ring buffers and deterministic lockstep.

Terminal window
pnpm add jolt-ts
import { World, Body, Shape } from "jolt-ts";
const world = await World.create({ gravity: [0, -9.81, 0] });
world.createBody({
type: "static",
shape: Shape.box({ halfExtents: [50, 0.5, 50] }),
position: [0, -0.5, 0],
layer: "static",
});
const ball = world.createBody(
Body.dynamic().shape(Shape.sphere(0.5)).translation(0, 8, 0).layer("moving"),
);
world.step(1 / 60);
ball.translation(); // { x, y, z }