Phaser API Documentation

applyForceFromPosition(bodies, position, speed, [angle])


Applies a force to a body, from the given world position, including resulting torque. If no angle is given, the current body angle is used.

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


name type arguments description
bodies Phaser.Types.Physics.Matter.MatterBody | Array.<Phaser.Types.Physics.Matter.MatterBody>

Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.

position Phaser.Types.Math.Vector2Like

A Vector that specifies the world-space position to apply the force at.

speed number

A speed value to be applied to a directional force.

angle number <optional>

The angle, in radians, to apply the force from. Leave undefined to use the current body angle.


This Matter Physics instance.

Since: 3.22.0