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.
Preparing WebGLRenderer, instanced buffers, and JoltPhysics...
- physics
- -
- boxes
- -
- spheres
- -
- bodies
- -
- resets
- -
- draws
- -
- fps
- -
Click a box or sphere to select its instance index. Jolt exposes indexed repositioning, not a general impulse method in this wrapper.
await JoltPhysics()load the WASM-backed addonmesh.userData.physicsdeclare mass/restitutionphysics.addScene(scene)register floor + instancessetMeshPosition(mesh, p, i)recreate indexed bodyinstanceMatrix.needsUpdateupload Jolt transformsThe 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.
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.