Class SAPBroadphase

Sweep and prune broadphase along one axis.

Hierarchy

Constructors

Properties

axisIndex: number = 0
axisList: Body[] = []

List of bodies currently in the broadphase.

boundingVolumeType: 2 | 1

The bounding volume type to use in the broadphase algorithms. Should be set to Broadphase.AABB or Broadphase.BOUNDING_CIRCLE.

result: Body[]

The resulting overlapping pairs. Will be filled with results during .getCollisionPairs().

type: 2 | 1
world?: World

The world to search for collision pairs in. To change it, use .setWorld()

AABB: 1 = ...

Axis aligned bounding box type.

BOUNDING_CIRCLE: 2 = ...

Bounding circle type.

NAIVE: 1 = ...

Naive Broadphase

SAP: 2 = ...

SAP Broadphase

Methods

  • Returns all the bodies within an AABB.

    Parameters

    • world: World
    • aabb: AABB
    • result: Body[] = []

      An array to store resulting bodies in.

    Returns Body[]

    Todo

    since the list is sorted, optimization can be done

  • Check whether the bounding volumes of two bodies overlap.

    Parameters

    Returns boolean

  • Change the world

    Parameters

    Returns void

  • Returns void

  • Check whether the AABB of two bodies overlap.

    Parameters

    Returns boolean

  • Check whether the bounding radius of two bodies overlap.

    Parameters

    Returns boolean

  • Check whether two bodies are allowed to collide at all.

    Parameters

    Returns boolean