Phaser API Documentation

  Version: 
chain(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, [options])

Description:

Chains all bodies in the given composite together using constraints.

Parameters:

name type arguments description
composite MatterJS.CompositeType

The composite in which all bodies will be chained together sequentially.

xOffsetA number

The horizontal offset of the BodyA constraint. This is a percentage based on the body size, not a world position.

yOffsetA number

The vertical offset of the BodyA constraint. This is a percentage based on the body size, not a world position.

xOffsetB number

The horizontal offset of the BodyB constraint. This is a percentage based on the body size, not a world position.

yOffsetB number

The vertical offset of the BodyB constraint. This is a percentage based on the body size, not a world position.

options Phaser.Types.Physics.Matter.MatterConstraintConfig <optional>

An optional Constraint configuration object that is used to set initial Constraint properties on creation.

Returns:
Description:

The original composite that was passed to this method.

Type:
  • MatterJS.CompositeType
Since: 3.0.0