API Docs for: 0.4.0
Show:

SAP1DBroadphase Class

Sweep and prune broadphase along one axis.

Constructor

SAP1DBroadphase

(
  • world
)

Parameters:

Methods

boundingRadiusCheck

(
  • bodyA
  • bodyB
)
Boolean

Check whether the bounding radius of two bodies overlap.

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/SAP1DBroadphase.js:76

Get the colliding pairs

Parameters:

Returns:

Array:

sortAxisListX

(
  • bodyA
  • bodyB
)
Number

Function for sorting bodies along the X axis. To be passed to array.sort()

Parameters:

Returns:

Number:

sortAxisListY

(
  • bodyA
  • bodyB
)
Number

Function for sorting bodies along the Y axis. To be passed to array.sort()

Parameters:

Returns:

Number:

Properties

axisIndex

Number

Axis to sort the bodies along. Set to 0 for x axis, and 1 for y axis. For best performance, choose an axis that the bodies are spread out more on.

axisList

Array

List of bodies currently in the broadphase.

result

Array

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

world

World

The world to search in.