Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventQueue

A structure responsible for collecting events generated by the physics engine. 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.

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

Hierarchy

  • EventQueue

Index

Constructors

constructor

  • new EventQueue(autoDrain: boolean, raw?: RawEventQueue): EventQueue
  • new EventQueue(autoDrain: boolean, raw?: RawEventQueue): EventQueue
  • 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

  • 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

raw: RawEventQueue

Methods

clear

  • clear(): void
  • clear(): void
  • Removes all events contained by this collector

    Returns void

  • Removes all events contained by this collector

    Returns void

drainContactEvents

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

    Parameters

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

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

    Returns void

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

    Parameters

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

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

    Returns void

drainIntersectionEvents

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

    Parameters

    • f: (handle1: ColliderHandle, handle2: ColliderHandle, intersecting: boolean) => void

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

    Returns void

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

    Parameters

    • f: (handle1: ColliderHandle, handle2: ColliderHandle, intersecting: boolean) => void

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

    Returns void

free

  • free(): void
  • free(): void
  • Release the WASM memory occupied by this event-queue.

    Returns void

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

    Returns void

Generated using TypeDoc