The Matter.Detector module contains methods for efficiently detecting collisions between a list of bodies using a broadphase algorithm.

Hierarchy

  • default

Constructors

Methods

  • The comparison function used in the broadphase algorithm. Returns the signed delta of the bodies bounds on the x-axis.

    Parameters

    Returns number

    The signed delta used for sorting

    Method

    _sortCompare

  • Returns true if both supplied collision filters will allow a collision to occur. See body.collisionFilter for more information.

    Parameters

    Returns boolean

    true if collision can occur

    Method

    canCollide

  • Efficiently finds all collisions among all the bodies in detector.bodies using a broadphase algorithm.

    Note: The specific ordering of collisions returned is not guaranteed between releases and may change for performance reasons. If a specific ordering is required then apply a sort to the resulting array.

    Parameters

    Returns ICollision[]

    collisions

    Method

    collisions

  • Creates a new collision detector.

    Parameters

    • Optional options: {
          bodies?: IBody[];
          pairs?: null | ({ table?: { [x: string]: { id?: string | undefined; bodyA?: { angle?: number | undefined; anglePrev?: number | undefined; angularSpeed?: number | undefined; angularVelocity?: number | undefined; ... 43 more ...; _original?: { ...; } | ... 1 more ... | undefined; } | undefined; ... 14 more ...; slop?: number | undefi...);
      }
      • Optional bodies?: IBody[]
      • Optional pairs?: null | ({ table?: { [x: string]: { id?: string | undefined; bodyA?: { angle?: number | undefined; anglePrev?: number | undefined; angularSpeed?: number | undefined; angularVelocity?: number | undefined; ... 43 more ...; _original?: { ...; } | ... 1 more ... | undefined; } | undefined; ... 14 more ...; slop?: number | undefi...)

    Returns IDetector

    A new collision detector

    Method

    create

Generated using TypeDoc