- Matter.Grid
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
grid
Object
bucket
Object
body
Object
Matter.Grid._bucketRemoveBody
(grid, bucket, body)
private
Removes a body from a bucket.
Parameters
grid
Object
bucket
Object
body
Object
Matter.Grid._createActivePairsList
(grid)
→ private
Generates a list of the active pairs in the grid.
Parameters
grid
Object
Returns
[] pairs
Matter.Grid._createBucket
(buckets, bucketId)
→ private
Creates a bucket.
Parameters
buckets
Object
bucketId
Object
Returns
bucket
Matter.Grid._createRegion
(startCol, endCol, startRow, endRow)
→ private
Creates a region.
Parameters
startCol
Object
endCol
Object
startRow
Object
endRow
Object
Returns
region
Matter.Grid._getBucketId
(column, row)
→ Stringprivate
Gets the bucket id at the given position.
Parameters
column
Object
row
Object
Returns
Stringbucket id
Matter.Grid._getRegion
(grid, body)
→ private
Gets the region a given body falls in for a given grid.
Parameters
grid
Object
body
Object
Returns
region
Matter.Grid._regionUnion
(regionA, regionB)
→ private
Finds the union of two regions.
Parameters
regionA
Object
regionB
Object
Returns
region
Matter.Grid.clear
(grid)
Clears the grid.
Parameters
grid
Grid
Matter.Grid.create
(options)
→ Grid
Creates a new grid.
Parameters
options
Object
Returns
GridA new grid
Matter.Grid.update
(grid, bodies, engine, forceUpdate)
Updates the grid.
Parameters
grid
Grid
bodies
Body[]
engine
Engine
forceUpdate
Boolean
Item Index
Methods
- _bucketAddBody
- _bucketRemoveBody
- _createActivePairsList
- _createBucket
- _createRegion
- _getBucketId
- _getRegion
- _regionUnion
- clear
- create
- update
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
The height of a single grid bucket.
Default: 48
Grid.bucketWidth
The width of a single grid bucket.
Default: 48