Show:
API

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 deprecated

Deprecated: moved to car example

This has now moved to the car example, follow that instead as this function is deprecated here.

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 deprecated

Deprecated: moved to newtonsCradle example

This has now moved to the newtonsCradle example, follow that instead as this function is deprecated here.

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 deprecated

Deprecated: moved to softBody and cloth examples

This has now moved to the softBody example and the cloth example, follow those instead as this function is deprecated here.

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