Core · interface

LoopOptions

Explained in The loop.

interface LoopOptions
import type { LoopOptions } from '@driftengine/core';

Properties

NameTypeDescription
fixedDtoptionalnumber
maxFrameTimeoptionalnumberClamp for pathological frames (tab switch, debugger) to avoid a sim spiral.
startTickoptionalnumberThe tick number the first fixed step reports. Zero unless a caller says otherwise.
More

A participant joining a session in progress is told the host's tick and has to agree with it, because every input and every snapshot is addressed by that number. Starting at zero and adding an offset at each use is the same arithmetic done in more places, and one of them eventually forgets.

frameSourceoptionalFrameSourceWho asks for the next frame, and what that frame carries.
More

The window, unless a session is driving. An immersive session produces frames on the headset's clock through session.requestAnimationFrame, at whatever rate its display runs, and the callback carries the frame object every pose in that frame is read from. A loop calling the window's requestAnimationFrame inside a session draws at the page's rate into a display that wanted something else, which is the difference between presence and motion sickness.

Optional and defaulting to the window, so no existing caller changes.

frame is unknown deliberately. This file is @driftengine/core's clock and has no business naming an XRFrame, which lives in a package core does not depend on; @driftengine/xr narrows it at the one place that reads it. What core owns is that something arrived with the frame and is handed to render unread.