Phaser.Physics.Matter.Components.Force
Scope: static
Source: src/physics/matter-js/components/Force.js#L9
Since: 3.0.0
Static functions
applyForce
<instance> applyForce(force)
Description:
Applies a force to a body at its current center of mass position.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| force | Phaser.Math.Vector2 | No | A 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
<instance> applyForceFrom(position, force)
Description:
Applies a force to a body from a given position.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| position | Phaser.Math.Vector2 | No | The position in which the force comes from. |
| force | Phaser.Math.Vector2 | No | A 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
<instance> thrust(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:
| name | type | optional | description |
|---|---|---|---|
| speed | number | No | A 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
<instance> thrustBack(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:
| name | type | optional | description |
|---|---|---|---|
| speed | number | No | A 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
<instance> thrustLeft(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:
| name | type | optional | description |
|---|---|---|---|
| speed | number | No | A 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
<instance> thrustRight(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:
| name | type | optional | description |
|---|---|---|---|
| speed | number | No | A 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