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 at its current center of mass position.

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#L23
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#L42
Since: 3.0.0


thrust

instancethrust(speed)

Description:

Apply thrust in the forward direction 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#L60
Since: 3.0.0


thrustBack

instancethrustBack(speed)

Description:

Apply thrust in the reverse direction 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#L129
Since: 3.0.0


thrustLeft

instancethrustLeft(speed)

Description:

Apply thrust in the left direction 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#L83
Since: 3.0.0


thrustRight

instancethrustRight(speed)

Description:

Apply thrust in the right direction 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#L106
Since: 3.0.0