Move the owner.
The main thread owns the camera, materials, InstancedMesh buffers, and renderer. A module worker owns the Rapier world and its fixed 60 Hz step loop, then transfers only the transforms needed for rendering.
Creating the main-thread scene while the worker loads Rapier...
- physics
- -
- instances
- -
- messages
- -
- transport
- -
- worker ms
- -
- sync ms
- -
- dropped
- -
- fps
- -
Select an instance to inspect the main-thread index sent to the worker.
new Worker(..., { type: 'module' })start an isolated modulenew RAPIER.World(gravity)keep physics off the DOM threadworld.timestep = 1 / 60use a fixed simulation steppostMessage(frame, [buffer])transfer, do not clone, transformsinstanceMatrix.needsUpdatepublish worker writeback to WebGLworker.terminate()close the lifecycle explicitlyA worker can’t touch the DOM or Three.js renderer here. It owns numeric simulation state only; the main thread consumes a transferable matrix snapshot and remains responsible for GPU submission.
The worker is loading Rapier. Once ready, the selected index will address one worker-owned rigid body.
Based on the official Rapier instancing example, Three.js worker guidance, InstancedMesh docs, and Rapier’s JavaScript guide. Measurements are local browser evidence, not a universal performance claim.