Documentation
    Preparing search index...

    Class PhysicsSystem

    Steps every tracked PhysicsWorld once per fixed step, then dispatches every world's events (§39 steps 6 and 9).

    See the module header for the two-pass ordering, the multi-world rationale, and what the system deliberately leaves to the application.

    Implements

    Index
    priority: number

    Execution order key (§39); default PRIORITY_PHYSICS_SOLVE.

    • get dispatchesEvents(): boolean

      Whether this system dispatches its worlds' queued events itself (§39 step 9), as opposed to leaving step 9 to another system.

      Fixed at construction: moving dispatch between priorities mid-run would deliver one step's events at two different points in the order, which is exactly the ambiguity §39's "explicit" forbids.

      Returns boolean

    • get size(): number

      How many worlds are tracked.

      Returns number

    • get worlds(): readonly PhysicsWorld[]

      The tracked worlds, in the order they are stepped.

      Returns readonly PhysicsWorld[]

    • Records that some other system dispatches this system's worlds' events, so that the "nobody is draining the queue" warning stays silent.

      PhysicsEventSystem calls this on itself at construction; call it yourself if you drive PhysicsWorld.dispatchEvents from your own system or from application code. Idempotent, and a no-op on a system that dispatches its own events.

      Returns void

    • Stops stepping everything. The system stays registered.

      Returns void

    • Drops every tracked world (§39 teardown).

      Deliberately does not dispose them: the system drives worlds, it does not own them, and PhysicsWorld.dispose also disposes the solver adapter.

      Returns void

    • Steps every tracked world by time.fixedDeltaTime seconds, then dispatches every world's queued events (§39 steps 6 and 9).

      The delta is the scaled simulation delta: §10 puts timeScale in the scheduler's accumulator, so a fixed step already is one fixedDeltaTime of simulation time and multiplying by timeScale here would scale it twice.

      The two passes iterate a live array. A listener that untracks a world during dispatch therefore skips that world's own dispatch if it has not run yet — the same "mutate outside the step" caveat every system in the engine carries. Allocates nothing.

      Parameters

      Returns void

    • Whether world is tracked.

      Parameters

      Returns boolean

    • No per-registration setup is needed (§39).

      Returns void

    • Starts stepping world and returns it, so a world can be built and tracked in one expression.

      Parameters

      Returns PhysicsWorld

      FourError if the same world is already tracked — stepping one world twice per fixed step would advance it at double rate and break §34 replay, which is not something to do by accident

    • Stops stepping world. Returns whether it was tracked.

      Parameters

      Returns boolean