Skip to content

Shapes gallery

jolt-ts builds every Jolt collider from a plain Shape.* descriptor. This scene drops one of each dynamic shape onto a static triangle-mesh mound, so you can see them all collide.

Drag to orbit

Loading physics…
import { Shape } from "jolt-ts";
Shape.sphere(0.45);
Shape.box({ halfExtents: [0.4, 0.4, 0.4] });
Shape.capsule({ halfHeight: 0.4, radius: 0.3 });
Shape.cylinder({ halfHeight: 0.4, radius: 0.4 });
// A convex hull is computed from a point cloud.
Shape.convexHull({ points: [[0, 0.6, 0], [0.5, 0.1, 0.3] /* … */] });
// A triangle mesh — for static geometry like terrain.
Shape.mesh({ vertices, indices });
// A compound glues child shapes into one rigid body.
Shape.compound([
{ shape: Shape.box({ halfExtents: [0.5, 0.06, 0.4] }) },
{ shape: Shape.box({ halfExtents: [0.08, 0.3, 0.08] }), position: [0.4, -0.3, 0.3] },
// …legs…
]);
// Offset the center of mass — a bottom-heavy "weeble" that self-rights.
Shape.offsetCenterOfMass(Shape.capsule({ halfHeight: 0.45, radius: 0.4 }), [0, -0.45, 0]);

Every builder returns a plain descriptor object, so you can store, serialize, or generate them. Pass one straight to world.createBody({ shape }), or reuse it via world.shapes.create().