Class: GridBroadphase

GridBroadphase()

This is a bounded broadphase that is used to speed up collision testing on dense number of objects over a small area.

Constructor

new GridBroadphase()

Source:

Extends

Classes

GridBroadphase

Methods

canCollide(a, b)

Checks to see if two bodies can proceed to have their bounding boxes checked
Parameters:
Name Type Description
a Body
b Body
Overrides:
Source:

draw()

Renders a representation of a broadphase
Overrides:
Source:

getCollisionPairs(target) → {Array.<CollisionPair>}

Gets all possibly colliding pairs.
Parameters:
Name Type Description
target Array.<CollisionPair> Empty array to store results.
Overrides:
Source:
Returns:
Type
Array.<CollisionPair>

insert(obj)

Adds a body to the broadphase
Parameters:
Name Type Description
obj Body
Overrides:
Source:

query(bounds, target) → {Array.<Body>}

Returns bodies that are within the given bound.
Parameters:
Name Type Description
bounds Bounds Region to check in.
target Array.<Body> Empty array to store results.
Overrides:
Source:
Returns:
Type
Array.<Body>

remove(obj)

Removes a body from the broadphase
Parameters:
Name Type Description
obj Body
Overrides:
Source:

update(bodies)

Updates the internals of the broadphase if needed.
Parameters:
Name Type Description
bodies Array.<Body>
Overrides:
Source: