API Docs for: 0.5.0
Show:

SAPBroadphase Class

Sweep and prune broadphase along one axis.

Constructor

SAPBroadphase

()

Methods

boundingRadiusCheck

(
  • bodyA
  • bodyB
)
Boolean

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

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:

checkBounds

(
  • bi
  • bj
  • axisIndex
)
Boolean static

Check if the bounds of two bodies overlap, along the given SAP axis.

Parameters:

Returns:

Boolean:

getCollisionPairs

(
  • world
)
Array

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

Get the colliding pairs

Parameters:

Returns:

Array:

setWorld

(
  • world
)

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

Change the world

Parameters:

sortAxisListX

(
  • a
)
Array

Sorts bodies along the X axis.

Parameters:

  • a Array

Returns:

Array:

sortAxisListY

(
  • a
)
Array

Sorts bodies along the Y axis.

Parameters:

  • a Array

Returns:

Array:

Properties

axisListX

Array

List of bodies currently in the broadphase.

axisListY

Array

List of bodies currently in the broadphase.

boundingVolumeType

Number

The bounding volume type to use in the broadphase algorithms.

result

Array

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

world

World

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

The world to search in.