Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Force
Phaser.Physics.Matter.Components.Force

Methods

applyForce(force)
Focus
Focus

Description:

Applies a force to a body.

Parameters:

name type description
force Phaser.Math.Vector2

A Vector that specifies the force to apply.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
applyForceFrom(position, force)
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
thrust(speed)
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
thrustLeft(speed)
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
thrustRight(speed)
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
thrustBack(speed)
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus