Taos API Reference
    Preparing search index...

    Class Time

    Per-frame simulation clock, owned by a Scene and advanced once per frame by the Engine before the scene's update traversal runs.

    Components reach it via Component.time (or gameObject.scene.time), so behaviors can read absolute time, the frame counter, and FPS without those values being threaded through update(dt). The dt argument still passed to Component.update is exactly Time.delta, so the two never disagree.

    scale is the payoff over a bare delta argument: setting it to 0 pauses all gameplay that reads delta/elapsed, and values between 0 and 1 (or above) give slow-motion / fast-forward. Behaviors that must ignore pause (UI animation, free-look cameras) read the unscaled* fields instead.

    Index

    Constructors

    Properties

    scale: number = 1

    Simulation time multiplier. 1 = real time, 0 = paused, 0.5 = half speed, 2 = double speed. Scales delta and the accumulation of elapsed; leaves the unscaled* fields untouched.

    delta: number = 0

    Scaled seconds since the previous frame (unscaledDelta * scale). This is the value handed to Component.update as dt. Use for gameplay.

    unscaledDelta: number = 0

    Real seconds since the previous frame, ignoring scale. Already clamped to a sane maximum to survive tab-switch / breakpoint stalls. Use for anything that must keep moving while paused.

    elapsed: number = 0

    Scaled seconds accumulated since engine start. Advances by delta each frame, so it stops while paused and tracks scale.

    unscaledElapsed: number = 0

    Real seconds since engine start, ignoring scale. Mirrors RenderContext.elapsedTime.

    frameCount: number = 0

    Total frames simulated since engine start (mirrors RenderContext.frameCount).

    fps: number = 0

    Smoothed frames-per-second (mirrors RenderContext.fps).

    Methods

    • Advance the clock by one frame. Called by the engine with the unscaled, clamped frame delta before scene.update runs.

      Parameters

      • unscaledDelta: number

        Real seconds since the previous frame (clamped).

      • unscaledElapsed: number

        Real seconds since engine start.

      • frameCount: number

        Total frames since engine start.

      • fps: number

        Smoothed frames-per-second.

      Returns void