Namespace: Velocity

Phaser.Physics.Matter.Components. Velocity

Contains methods for changing the velocity of a Matter Body. Should be used as a mixin and not called directly.

Since: 3.0.0
Source: src/physics/matter-js/components/Velocity.js (Line 9)

Methods


setAngularVelocity(value)

Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged.

Parameters:
Name Type Description
value number

The angular velocity.

Since: 3.0.0
Source: src/physics/matter-js/components/Velocity.js (Line 17)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

setVelocity(x [, y])

Sets both the horizontal and vertical velocity of the physics body.

Parameters:
Name Type Argument Default Description
x number

The horizontal velocity value.

y number <optional>
x

The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the x value.

Since: 3.0.0
Source: src/physics/matter-js/components/Velocity.js (Line 73)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

setVelocityX(x)

Sets the horizontal velocity of the physics body.

Parameters:
Name Type Description
x number

The horizontal velocity value.

Since: 3.0.0
Source: src/physics/matter-js/components/Velocity.js (Line 35)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject

setVelocityY(y)

Sets vertical velocity of the physics body.

Parameters:
Name Type Description
y number

The vertical velocity value.

Since: 3.0.0
Source: src/physics/matter-js/components/Velocity.js (Line 54)
Returns:

This Game Object.

Type
Phaser.GameObjects.GameObject