recorder.module
README.md
recorder
Records what this peer draws of a hierarchy and plays it back as local ghosts, at any speed. It exists
because the engine has no record and playback of the simulation (#20544). The CrashRig component uses it
for the slow-motion replay; any game can use it for kill-cams or instant replays.
Rec.new{ roots, track, hz = 60, maxSeconds = 8, ghostLayer = "default" }creates a recorder.rootsare entity ids whose whole hierarchy is recorded: every entity with aModel, plus the particles of everySoftBodyunder them.trackadds entities to record even without aModel, such as a camera target.
rec:start(),rec:stop(),rec:duration()andrec:frames()control and report the recording. Recording rescans its roots every 0.1 s, so pieces that appear later, like a panel coming off, are caught.rec:addRoot(id)andrec:addTrack(id)add to a recording that is already running.rec:trim(t0, t1)keeps only that window, in seconds since the start.rec:play{ speed = 0.25, loop, onFrame, onDone }plays it back and returns{ stop(), time(), playing(), ghostOf(id) }.- It spawns local, temporary ghosts: a
Modelfor each rigid piece, and a non-colliding soft body for each soft body, whose particles are written every frame, so dents replay as they formed. ghostOf(id)gives the ghost standing in for a live entity, to aim cameras at.
- It spawns local, temporary ghosts: a
Nothing crosses the wire: each peer replays what it drew. Hide the live entities from the replay camera
with a render layer. The rig puts them on crash, so its replay camera draws "all !crash".