Matter.Grid

Defined in: src/collision/Grid.js:1

The Matter.Grid module contains methods for creating and manipulating collision broadphase grid structures.

Methods

Matter.Grid._bucketAddBody

(grid, bucket, body)

private

Adds a body to a bucket.

Parameters

@ src/collision/Grid.js:233

Matter.Grid._bucketRemoveBody

(grid, bucket, body)

private

Removes a body from a bucket.

Parameters

@ src/collision/Grid.js:265

Matter.Grid._createActivePairsList

(grid)

→ private

Generates a list of the active pairs in the grid.

Parameters

Returns

[] pairs

@ src/collision/Grid.js:290

Matter.Grid._createBucket

(buckets, bucketId)

→ private

Creates a bucket.

Parameters

Returns

bucket

@ src/collision/Grid.js:220

Matter.Grid._createRegion

(startCol, endCol, startRow, endRow)

→ private

Creates a region.

Parameters

Returns

region

@ src/collision/Grid.js:188

Matter.Grid._getBucketId

(column, row)

Stringprivate

Gets the bucket id at the given position.

Parameters

Returns

Stringbucket id

@ src/collision/Grid.js:208

Matter.Grid._getRegion

(grid, body)

→ private

Gets the region a given body falls in for a given grid.

Parameters

Returns

region

@ src/collision/Grid.js:170

Matter.Grid._regionUnion

(regionA, regionB)

→ private

Finds the union of two regions.

Parameters

Returns

region

@ src/collision/Grid.js:153

Matter.Grid.clear

(grid)

Clears the grid.

Parameters

@ src/collision/Grid.js:142

Matter.Grid.create

(options)

Grid

Creates a new grid.

Parameters

Returns

GridA new grid

@ src/collision/Grid.js:17

Matter.Grid.update

(grid, bodies, engine, forceUpdate)

Updates the grid.

Parameters

@ src/collision/Grid.js:53

Item Index

Methods

Properties

The following properties are specified for objects created by <span class="prefix">Matter.</span>.create and for objects passed to it via the options argument.

Properties

The following properties are specified for objects created by Matter.Grid.create and for objects passed to it via the options argument.

Grid.bucketHeight

Number

The height of a single grid bucket.

Default: 48

@ src/collision/Grid.js:45

Grid.bucketWidth

Number

The width of a single grid bucket.

Default: 48

@ src/collision/Grid.js:37