#

API Docs for: 0.6.0
Show: Inherited Protected Private Deprecated

# Narrowphase Class

Defined in: `src/world/Narrowphase.js:12`

Helper class for the World. Generates ContactEquations.

## Constructor

### `Narrowphase`

()

Defined in `src/world/Narrowphase.js:12`

- Index
- Methods
- Properties

## Item Index

### Methods

- convexConvex
- convexParticle
- getContacts
- makeResult
- narrowphase
- particlePlane
- particleSphere
- planeBox
- planeConvex
- reduceContacts
- sphereBox
- sphereConvex
- sphereHeightfield
- sphereHeightfield
- spherePlane
- sphereSphere
- swapResult

### Properties

- bool contactReduction
- contactPointPool
- v3pool

## Methods

### `convexConvex`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:1007`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `convexParticle`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:1135`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `getContacts`

(

- `p1`
- `p2`
- `world`
- `result`
- `oldcontacts`

)

Defined in `src/world/Narrowphase.js:93`

Generate all contacts between a list of body pairs

#### Parameters:

- `p1` Array

  Array of body indices

- `p2` Array

  Array of body indices

- `world` World
- `result` Array

  Array to store generated contacts

- `oldcontacts` Array

  Optional. Array of reusable contact objects

### `makeResult`

() ContactEquation

Defined in `src/world/Narrowphase.js:66`

Make a contact object, by using the internal pool or creating a new one.

#### Returns:

ContactEquation:

### `narrowphase`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`

)

Defined in `src/world/Narrowphase.js:168`

Narrowphase calculation. Get the ContactEquations given two shapes: i and j

#### Parameters:

- `result` Array

  The result one will get back with all the contact point information

- `si` Shape

  Colliding shape. If not given, particle is assumed.

- `sj` Shape
- `xi` Vec3

  Position of the center of mass

- `xj` Vec3
- `qi` Quaternion

  Rotation around the center of mass

- `qj` Quaternion

### `particlePlane`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:1055`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `particleSphere`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:1095`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `planeBox`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:916`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `planeConvex`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:938`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `reduceContacts`

(

- `contacts`

)

Defined in `src/world/Narrowphase.js:57`

Removes unnecessary members of an array of ContactEquation.

#### Parameters:

- `contacts` Array

### `sphereBox`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:480`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `sphereConvex`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:699`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `sphereHeightfield`

()

Defined in `src/world/Narrowphase.js:1306`

### `sphereHeightfield`

()

Defined in `src/world/Narrowphase.js:1229`

### `spherePlane`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:385`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `sphereSphere`

(

- `result`
- `si`
- `sj`
- `xi`
- `xj`
- `qi`
- `qj`
- `bi`
- `bj`

)

Defined in `src/world/Narrowphase.js:353`

#### Parameters:

- `result` Array
- `si` Shape
- `sj` Shape
- `xi` Vec3
- `xj` Vec3
- `qi` Quaternion
- `qj` Quaternion
- `bi` Body
- `bj` Body

### `swapResult`

(

- `object`

)

Defined in `src/world/Narrowphase.js:41`

Swaps the body references in the contact

#### Parameters:

- `object` Object

  r

## Properties

### `bool contactReduction`

Unknown

Defined in `src/world/Narrowphase.js:22`

Turns on or off contact reduction. Can be handy to turn off when debugging new collision types.

### `contactPointPool`

Array

Defined in `src/world/Narrowphase.js:28`

Internal storage of pooled contact points.

### `v3pool`

Vec3Pool

Defined in `src/world/Narrowphase.js:34`

Pooled vectors.