THREE.JS / FOUNDATIONS 198

One mesh. Many bodies.

The official Jolt example turns two InstancedMesh objects into hundreds of physics bodies. This study keeps the indexed transform path visible: Jolt owns the bodies, Three.js owns the instance buffers.

Initializing Preparing renderer

Preparing WebGLRenderer, instanced buffers, and JoltPhysics...

physics
-
boxes
-
spheres
-
bodies
-
resets
-
draws
-
fps
-
Indexed body controlssetMeshPosition

Click a box or sphere to select its instance index. Jolt exposes indexed repositioning, not a general impulse method in this wrapper.

Jolt contractinstanced bodies
await JoltPhysics()load the WASM-backed addon
mesh.userData.physicsdeclare mass/restitution
physics.addScene(scene)register floor + instances
setMeshPosition(mesh, p, i)recreate indexed body
instanceMatrix.needsUpdateupload Jolt transforms

The addon supports BoxGeometry, SphereGeometry, and IcosahedronGeometry, including InstancedMesh. Its current wrapper has no official collider helper, impulse, or remove-mesh method; those differences are part of the study.

Selected instancenone
source mesh-
instance index-
body type-
reposition API-

Jolt is loading. The external addon requires an active Internet connection and a page lifecycle that can tolerate its internal timer.

Based on the official Jolt instancing example. Orbit the field, select an instance, and use indexed repositioning to see how two shared InstancedMesh buffers can carry many physics bodies.

THREE.JS FOUNDATIONS LAB