Show:

Matter.Composites

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

Composite

A new composite car body

Matter.Composites.chain

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

Chains all bodies in the given composite together using constraints.

Parameters

Returns

Composite

A new composite containing objects chained together with constraints

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

Composite

The composite containing objects meshed together with constraints

Matter.Composites.newtonsCradle

(xx, yy, number, size, length)
Composite

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

Parameters

Returns

Composite

A new composite newtonsCradle body

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

Composite

A new composite containing objects created in the callback

Matter.Composites.softBody

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

Creates a simple soft body like object.

Parameters

Returns

Composite

A new composite softBody

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

Composite

A new composite containing objects created in the callback

0.11.0