API Docs for: 0.6.0
Show:

Broadphase Class

Base class for broadphase implementations

Constructor

Broadphase

()

Methods

aabbQuery

(
  • world
  • aabb
)
Array

Returns all the bodies within the AABB.

Parameters:

Returns:

Array:

collisionPairs

(
  • world
  • Array
  • Array
)

Get the collision pairs from the world

Parameters:

  • world World

    The world to search in

  • Array Object

    p1 Empty array to be filled with body objects

  • Array Object

    p2 Empty array to be filled with body objects

Returns:

array An array with two subarrays of body indices

doBoundingBoxBroadphase

(
  • Body
  • Body
  • pairs1
  • pairs2
)

Check if the bounding boxes of two bodies are intersecting.

Parameters:

  • Body Object

    bi

  • Body Object

    bj

  • pairs1 Array
  • pairs2 Array

doBoundingSphereBroadphase

(
  • bi
  • bj
  • pairs1
  • pairs2
)

Check if the bounding spheres of two bodies are intersecting.

Parameters:

  • bi Body
  • bj Body
  • pairs1 Array

    bi is appended to this array if intersection

  • pairs2 Array

    bj is appended to this array if intersection

intersectionTest

(
  • bodyA
  • bodyB
  • pairs1
  • pairs2
)

Check if the bounding volumes of two bodies intersect.

Parameters:

  • bodyA Body
  • bodyB Body
  • pairs1 Array
  • pairs2 Array

makePairsUnique

(
  • pairs1
  • pairs2
)

Removes duplicate pairs from the pair arrays.

Parameters:

  • pairs1 Array
  • pairs2 Array

needBroadphaseCollision

(
  • bodyA
  • bodyB
)
Bool

Check if a body pair needs to be intersection tested at all.

Parameters:

Returns:

Bool:

setWorld

(
  • world
)

To be implemented by subcasses

Parameters:

Properties

useBoundingBoxes

Boolean

If set to true, the broadphase uses bounding boxes for intersection test, else it uses bounding spheres.

world

World

The world to search for collisions in.