Class EventQueue

A structure responsible for collecting events generated by the physics engine.

To avoid leaking WASM resources, this MUST be freed manually with eventQueue.free() once you are done using it.

Hierarchy

  • EventQueue

Constructors

  • Creates a new event collector.

    Parameters

    • autoDrain: boolean

      setting this to true is strongly recommended. If true, the collector will be automatically drained before each world.step(collector). If false, the collector will keep all events in memory unless it is manually drained/cleared; this may lead to unbounded use of RAM if no drain is performed.

    • Optional raw: RawEventQueue

    Returns EventQueue

Properties

raw: RawEventQueue

Methods

  • Removes all events contained by this collector

    Returns void

  • Applies the given javascript closure on each collision event of this collector, then clear the internal collision event buffer.

    Parameters

    • f: ((handle1: number, handle2: number, started: boolean) => void)

      JavaScript closure applied to each collision event. The closure must take three arguments: two integers representing the handles of the colliders involved in the collision, and a boolean indicating if the collision started (true) or stopped (false).

        • (handle1: number, handle2: number, started: boolean): void
        • Parameters

          • handle1: number
          • handle2: number
          • started: boolean

          Returns void

    Returns void

  • Applies the given javascript closure on each contact force event of this collector, then clear the internal collision event buffer.

    Parameters

    Returns void

  • Release the WASM memory occupied by this event-queue.

    Returns void

Generated using TypeDoc