Phaser.Physics.Matter.Components.Velocity

Scope: static

Source: src/physics/matter-js/components/Velocity.js#L9
Since: 3.0.0

Methods:

Public Members

getAngularSpeed

<instance> getAngularSpeed()

Description:

Gets the current rotational speed of the body. Equivalent to the magnitude of its angular velocity.

Returns: number - The current angular velocity of the body.

Source: src/physics/matter-js/components/Velocity.js#L137
Since: 3.60.0


getAngularVelocity

<instance> getAngularVelocity()

Description:

Gets the current rotational velocity of the body.

Returns: number - The current angular velocity of the body.

Source: src/physics/matter-js/components/Velocity.js#L106
Since: 3.60.0


getVelocity

<instance> getVelocity()

Description:

Gets the current linear velocity of the physics body.

Returns: Phaser.Types.Math.Vector2Like - The current linear velocity of the body.

Source: src/physics/matter-js/components/Velocity.js#L75
Since: 3.60.0


setAngularSpeed

<instance> setAngularSpeed(speed)

Description:

Sets the current rotational speed of the body. Direction is maintained. Affects body angular velocity.

Parameters:

nametypeoptionaldescription
speednumberNoThe angular speed.

Returns: Phaser.Physics.Matter.Components.Velocity - This Game Object instance.

Source: src/physics/matter-js/components/Velocity.js#L119
Since: 3.60.0


setAngularVelocity

<instance> setAngularVelocity(velocity)

Description:

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

Parameters:

nametypeoptionaldescription
velocitynumberNoThe angular velocity.

Returns: Phaser.Physics.Matter.Components.Velocity - This Game Object instance.

Source: src/physics/matter-js/components/Velocity.js#L88
Since: 3.0.0


setVelocity

<instance> setVelocity(x, [y])

Description:

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

Parameters:

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

Returns: Phaser.Physics.Matter.Components.Velocity - This Game Object instance.

Source: src/physics/matter-js/components/Velocity.js#L55
Since: 3.0.0


setVelocityX

<instance> setVelocityX(x)

Description:

Sets the horizontal velocity of the physics body.

Parameters:

nametypeoptionaldescription
xnumberNoThe horizontal velocity value.

Returns: Phaser.Physics.Matter.Components.Velocity - This Game Object instance.

Source: src/physics/matter-js/components/Velocity.js#L17
Since: 3.0.0


setVelocityY

<instance> setVelocityY(y)

Description:

Sets vertical velocity of the physics body.

Parameters:

nametypeoptionaldescription
ynumberNoThe vertical velocity value.

Returns: Phaser.Physics.Matter.Components.Velocity - This Game Object instance.

Source: src/physics/matter-js/components/Velocity.js#L36
Since: 3.0.0


Private Members

Updated on