Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

phys.snapshot

Put the whole physics simulation back to a moment. take holds a snapshot under a name: every rigid body, collider, joint (with the impulses it carries and whether it broke), soft body (particles, elements and the dents it took), contact and warm-start impulse, vehicle, drivetrain, held force and plane hold, as they stand between two steps. restore puts all of it back, so the steps after it run exactly as they ran from the moment the snapshot was taken, bit for bit (Physics.stateDigest reads the same digest), however many times it is restored: a bridge builder tests a bridge and resets it, a crash test retries from the moment before impact, a puzzle undoes a move. save writes a held snapshot to a VFS file in a versioned format that is the same on every platform, and load reads it back under a name, on this engine or another holding the same scene. list names what is held, with each snapshot's step, size in bytes and counts; release lets one go.

A restore needs the scene to hold the bodies the snapshot was taken over; one into a scene whose bodies were added, removed or rebuilt since is refused, changing nothing, and the error names every entity in the way. Forces and moves queued for the coming steps stay queued, and listeners and recordings keep running. Wraps Physics.snapshot, Physics.restore and Physics.loadSnapshot; the physics guide's "Snapshots" section has the whole surface.