Namespace: Force

Phaser.Physics.Matter.Components. Force

A component to apply force to Matter.js bodies.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 9)

Methods


applyForce(force)

Applies a force to a body.

Parameters:
Name Type Description
force Phaser.Math.Vector2

A Vector that specifies the force to apply.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 19)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

applyForceFrom(position, force)

Applies a force to a body from a given position.

Parameters:
Name Type Description
position Phaser.Math.Vector2

The position in which the force comes from.

force Phaser.Math.Vector2

A Vector that specifies the force to apply.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 38)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

thrust(speed)

Apply thrust to the forward position of the body.

Use very small values, such as 0.1, depending on the mass and required speed.

Parameters:
Name Type Description
speed number

A speed value to be applied to a directional force.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 56)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

thrustBack(speed)

Apply thrust to the back position of the body.

Use very small values, such as 0.1, depending on the mass and required speed.

Parameters:
Name Type Description
speed number

A speed value to be applied to a directional force.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 125)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

thrustLeft(speed)

Apply thrust to the left position of the body.

Use very small values, such as 0.1, depending on the mass and required speed.

Parameters:
Name Type Description
speed number

A speed value to be applied to a directional force.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 79)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

thrustRight(speed)

Apply thrust to the right position of the body.

Use very small values, such as 0.1, depending on the mass and required speed.

Parameters:
Name Type Description
speed number

A speed value to be applied to a directional force.

Since: 3.0.0
Source: src/physics/matter-js/components/Force.js (Line 102)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject