#

API Docs for: 0.6.0
Show: Inherited Protected Private Deprecated

# Broadphase Class

Defined in: `src/collision/Broadphase.js:9`

Base class for broadphase implementations

## Constructor

### `Broadphase`

()

Defined in `src/collision/Broadphase.js:9`

- Index
- Methods
- Properties

## Item Index

### Methods

- aabbQuery
- collisionPairs
- doBoundingBoxBroadphase
- doBoundingSphereBroadphase
- intersectionTest
- makePairsUnique
- needBroadphaseCollision
- setWorld

### Properties

- useBoundingBoxes
- world

## Methods

### `aabbQuery`

(

- `world`
- `aabb`

)
Array

Defined in `src/collision/Broadphase.js:206`

Returns all the bodies within the AABB.

#### Parameters:

- `world` World
- `aabb` AABB

#### Returns:

Array:

### `collisionPairs`

(

- `world`
- `Array`
- `Array`

)

Defined in `src/collision/Broadphase.js:33`

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`

)

Defined in `src/collision/Broadphase.js:123`

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`

)

Defined in `src/collision/Broadphase.js:100`

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`

)

Defined in `src/collision/Broadphase.js:84`

Check if the bounding volumes of two bodies intersect.

#### Parameters:

- `bodyA` Body
- `bodyB` Body
- `pairs1` Array
- `pairs2` Array

### `makePairsUnique`

(

- `pairs1`
- `pairs2`

)

Defined in `src/collision/Broadphase.js:151`

Removes duplicate pairs from the pair arrays.

#### Parameters:

- `pairs1` Array
- `pairs2` Array

### `needBroadphaseCollision`

(

- `bodyA`
- `bodyB`

)
Bool

Defined in `src/collision/Broadphase.js:45`

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

#### Parameters:

- `bodyA` Body
- `bodyB` Body

#### Returns:

Bool:

### `setWorld`

(

- `world`

)

Defined in `src/collision/Broadphase.js:191`

To be implemented by subcasses

#### Parameters:

- `world` World

## Properties

### `useBoundingBoxes`

Boolean

Defined in `src/collision/Broadphase.js:23`

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

### `world`

World

Defined in `src/collision/Broadphase.js:16`

The world to search for collisions in.