You’re reading the docs for Phaser v3.90.0. The latest is Phaser v4.1.0.

Phaser.Physics.Matter.Components.Force

Scope: static

Source: src/physics/matter-js/components/Force.js#L9
Since: 3.0.0

Static functions

applyForce

instanceapplyForce(force)

Description:

Applies a force to a body.

Parameters:

nametypeoptionaldescription
forcePhaser.Math.Vector2NoA Vector that specifies the force to apply.

Returns: Phaser.Physics.Matter.Components.Force - This Game Object instance.

Source: src/physics/matter-js/components/Force.js#L19
Since: 3.0.0


applyForceFrom

instanceapplyForceFrom(position, force)

Description:

Applies a force to a body from a given position.

Parameters:

nametypeoptionaldescription
positionPhaser.Math.Vector2NoThe position in which the force comes from.
forcePhaser.Math.Vector2NoA Vector that specifies the force to apply.

Returns: Phaser.Physics.Matter.Components.Force - This Game Object instance.

Source: src/physics/matter-js/components/Force.js#L38
Since: 3.0.0


thrust

instancethrust(speed)

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:

nametypeoptionaldescription
speednumberNoA speed value to be applied to a directional force.

Returns: Phaser.Physics.Matter.Components.Force - This Game Object instance.

Source: src/physics/matter-js/components/Force.js#L56
Since: 3.0.0


thrustBack

instancethrustBack(speed)

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:

nametypeoptionaldescription
speednumberNoA speed value to be applied to a directional force.

Returns: Phaser.Physics.Matter.Components.Force - This Game Object instance.

Source: src/physics/matter-js/components/Force.js#L125
Since: 3.0.0


thrustLeft

instancethrustLeft(speed)

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:

nametypeoptionaldescription
speednumberNoA speed value to be applied to a directional force.

Returns: Phaser.Physics.Matter.Components.Force - This Game Object instance.

Source: src/physics/matter-js/components/Force.js#L79
Since: 3.0.0


thrustRight

instancethrustRight(speed)

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:

nametypeoptionaldescription
speednumberNoA speed value to be applied to a directional force.

Returns: Phaser.Physics.Matter.Components.Force - This Game Object instance.

Source: src/physics/matter-js/components/Force.js#L102
Since: 3.0.0