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

(x, y, 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

(x, y, 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

(x, y, 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

(x, y, 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

(x, y, 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