Phaser API Documentation

  Version: 
setVelocityX(bodies, x)

Description:

Sets just the horizontal linear velocity of the physics bodies. The vertical velocity of the body is unchanged.

Parameters:

name type 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.

x number

The horizontal linear velocity value.

Returns:
Description:

This Matter Physics instance.

Since: 3.22.0