Save the state.
A physics scene is more useful when it can be captured, restored, and replayed. This route keeps Rapier's serialized world beside the Three.js instance buffers, then checks whether identical inputs and fixed steps produce identical snapshot bytes.
Preparing a directly owned Rapier world and shared instance buffers...
- physics
- -
- bodies
- -
- snapshot
- -
- checksum
- -
- step ms
- -
- replay
- -
- selected
- -
- fps
- -
The selected body is addressed by its creation-order slot and mirrored into one Three.js instance matrix.
world.takeSnapshot()serialize the whole worldWorld.restoreSnapshot(bytes)create an identical worldUint8Arraysave or transfer the state payloadworld.profilerEnabled = trueenable internal step timingsworld.timingStep()read the last physics step costinstanceMatrix.needsUpdatepublish restored transforms to WebGLThe replay check compares serialized bytes after the same deterministic impulse and 60 fixed steps. The displayed checksum is a local FNV-1a diagnostic; it is not the MD5 procedure described in Rapier's documentation.
Rapier is loading. Once ready, the selected body can be inspected before and after capture/restore.
Based on the official Rapier serialization guide, determinism guide, Rapier package guidance, World API, and InstancedMesh docs. Measurements are local browser evidence, not a universal determinism or performance claim.