Show:

Matter.Grid

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

Matter.Grid._bucketRemoveBody

(grid, bucket, body)
private

Removes a body from a bucket.

Parameters

Matter.Grid._createActivePairsList

(grid)
private

Generates a list of the active pairs in the grid.

Parameters

Returns

[] pairs

Matter.Grid._createBucket

(buckets, bucketId)
private

Creates a bucket.

Parameters

Returns

bucket

Matter.Grid._createRegion

(startCol, endCol, startRow, endRow)
private

Creates a region.

Parameters

Returns

region

Matter.Grid._getBucketId

(column, row)
String private

Gets the bucket id at the given position.

Parameters

Returns

String

bucket id

Matter.Grid._getRegion

(grid, body)
private

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

Parameters

Returns

region

Matter.Grid._regionUnion

(regionA, regionB)
private

Finds the union of two regions.

Parameters

Returns

region

Matter.Grid.clear

(grid)

Clears the grid.

Parameters

Matter.Grid.create

(options)
Grid

Creates a new grid.

Parameters

Returns

Grid

A new grid

Matter.Grid.update

(grid, bodies, engine, forceUpdate)

Updates the grid.

Parameters

Item Index

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.

The height of a single grid bucket.

Default: 48

The width of a single grid bucket.

Default: 48

0.13.0