ReadonlyjoltReadonlyjoltReadonlysystemReadonlybodyReadonlytempTemp allocator, needed by CharacterVirtual updates.
StaticcreateCreates a physics world, loading the Jolt WASM backend on first use. Pass
PhysicsInitOptions (e.g. { wasmUrl }) on the first call if you're
not building with Vite; with Vite, no arguments are needed.
Optionalopts: PhysicsInitOptionsPacks a (group, mask) pair into a Jolt object layer.
Builds a mask-aware object-layer filter for collision queries (raycasts,
character sweeps): it accepts a body when its layer collides with
objectLayer per the world's pair filter. The caller owns the returned
filter and must jolt.destroy() it. Unlike SpecifiedObjectLayerFilter
(exact-equality), this honours the (group, mask) collision rules.
Builds the matching broad-phase filter for objectLayer. Caller destroys.
Sets world gravity (default is (0, -9.81, 0)).
Casts a ray against every collider and returns the closest hit point (world
space), or null if nothing was hit. direction is the full ray vector — its
length is the maximum cast distance. Useful for grounding a camera/character
against the streamed terrain colliders. staticOnly restricts the cast to
the World (non-moving) layer so a ray fired from above an actor doesn't hit
the actor itself.
Fast straight-down ground raycast that allocates no Jolt objects per call
(it reuses cached scratch), so it's safe to call hundreds of times per frame —
e.g. baking a collision heightmap by sampling the streamed colliders. Casts
from (x, y, z) down dist meters and returns the world Y of the closest hit,
or null. staticOnly restricts to the World layer (ignores dynamic actors,
so a ray over the player doesn't hit the player).
Adds an axis-aligned box body. half is the half-extent on each axis.
Adds a capsule body — the standard actor/projectile shape. halfHeight is
the half-length of the cylindrical section (excluding the hemispherical
caps), so total height is 2 * (halfHeight + radius). The capsule's axis is
the local Y (up) axis.
Adds a static triangle-mesh collider from raw geometry — arbitrary,
possibly concave "soup" (ramps, level geometry, the surface of a wavy
terrain). positions is packed xyz triplets; indices is a triangle list.
Triangle meshes have no defined inertia, so Jolt only allows them on static
(or kinematic) bodies — this is the standard rule in every physics engine.
opts tunes the static body's surface and collision layer/mask.
Adds a static height-field collider — the fast, memory-light path for
terrain. heights is a sampleCount × sampleCount row-major grid of world
Y values (index = z·sampleCount + x); cellSize is the world spacing
between samples; the field is placed so its origin sample sits at originXz.
Adds a dynamic body whose shape is the convex hull of points — the
way to give a falling object a custom (convex) mesh shape. For concave
objects, decompose into several hulls and combine with a compound shape.
Creates and adds a constraint between two bodies (e.g. a
PointConstraintSettings). The settings object is consumed and destroyed.
Advances the simulation. Sub-steps long frames to keep each step stable.
Removes and destroys every body and constraint, leaving the world empty.
Removes and destroys a single body. Its shape frees once no body holds it.
Full teardown: clears the world then frees the Jolt interface itself.
The runtime Jolt module — use for
new this.jolt.Vec3(...)etc.