Matter.Composites

Defined in: src/factory/Composites.js:1

The Matter.Composites module contains factory methods for creating composite bodies with commonly used configurations (such as stacks and chains).

See the included usage examples.

Methods

Matter.Composites.car

(xx, yy, width, height, wheelSize)

Composite

Creates a composite with simple car setup of bodies and constraints.

Parameters

Returns

CompositeA new composite car body

@ src/factory/Composites.js:230

Matter.Composites.chain

(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options)

Composite

Chains all bodies in the given composite together using constraints.

Parameters

Returns

CompositeA new composite containing objects chained together with constraints

@ src/factory/Composites.js:75

Matter.Composites.mesh

(composite, columns, rows, crossBrace, options)

Composite

Connects bodies in the composite with constraints in a grid pattern, with optional cross braces.

Parameters

Returns

CompositeThe composite containing objects meshed together with constraints

@ src/factory/Composites.js:114

Matter.Composites.newtonsCradle

(xx, yy, number, size, length)

Composite

Creates a composite with a Newton's Cradle setup of bodies and constraints.

Parameters

Returns

CompositeA new composite newtonsCradle body

@ src/factory/Composites.js:204

Matter.Composites.pyramid

(xx, yy, columns, rows, columnGap, rowGap, callback)

Composite

Create a new composite containing bodies created in the callback in a pyramid arrangement. This function uses the body's bounds to prevent overlaps.

Parameters

Returns

CompositeA new composite containing objects created in the callback

@ src/factory/Composites.js:163

Matter.Composites.softBody

(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions)

Composite

Creates a simple soft body like object.

Parameters

Returns

CompositeA new composite softBody

@ src/factory/Composites.js:297

Matter.Composites.stack

(xx, yy, columns, rows, columnGap, rowGap, callback)

Composite

Create a new composite containing bodies created in the callback in a grid arrangement. This function uses the body's bounds to prevent overlaps.

Parameters

Returns

CompositeA new composite containing objects created in the callback

@ src/factory/Composites.js:22

Item Index

Methods