API Docs for: 0.7.1
Show:

SAPBroadphase Class

Sweep and prune broadphase along one axis.

Constructor

SAPBroadphase

()

Methods

aabbQuery

(
  • world
  • aabb
  • result
)
Array

Returns all the bodies within an AABB.

Parameters:

  • world World
  • aabb AABB
  • result Array

    An array to store resulting bodies in.

Returns:

Array:

boundingRadiusCheck

(
  • bodyA
  • bodyB
)
Boolean

Inherited from Broadphase but overwritten in src/collision/Broadphase.js:70

Check whether the bounding radius of two bodies overlap.

Parameters:

Returns:

Boolean:

canCollide

(
  • bodyA
  • bodyB
)
Boolean

Check whether two bodies are allowed to collide at all.

Parameters:

Returns:

Boolean:

getCollisionPairs

(
  • world
)
Array

Inherited from Broadphase but overwritten in src/collision/SAPBroadphase.js:99

Get the colliding pairs

Parameters:

Returns:

Array:

setWorld

(
  • world
)

Inherited from Broadphase but overwritten in src/collision/SAPBroadphase.js:46

Change the world

Parameters:

sortAxisList

(
  • a
  • axisIndex
)
Array

Sorts bodies along an axis.

Parameters:

  • a Array
  • axisIndex Number

Returns:

Array:

Properties

axisIndex

Number

The axis to sort along. 0 means x-axis and 1 y-axis. If your bodies are more spread out over the X axis, set axisIndex to 0, and you will gain some performance.

axisList

Array

List of bodies currently in the broadphase.

boundingVolumeType

Number

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

result

Array

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

world

World

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