Namespace: Friction

Phaser.Physics.Arcade.Components. Friction

Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis. The higher than friction, the faster the body will slow down once force stops being applied to it.

Since: 3.0.0
Source: src/physics/arcade/components/Friction.js (Line 7)

Methods


setFriction(x [, y])

Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving. The higher than friction, the faster the body will slow down once force stops being applied to it.

Parameters:
Name Type Argument Default Description
x number

The amount of horizontal friction to apply.

y number <optional>
x

The amount of vertical friction to apply.

Since: 3.0.0
Source: src/physics/arcade/components/Friction.js (Line 15)
Returns:

This Game Object.

Type
Phaser.Physics.Arcade.Components.Friction

setFrictionX(x)

Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis. The higher than friction, the faster the body will slow down once force stops being applied to it.

Parameters:
Name Type Description
x number

The amount of friction to apply.

Since: 3.0.0
Source: src/physics/arcade/components/Friction.js (Line 34)
Returns:

This Game Object.

Type
Phaser.Physics.Arcade.Components.Friction

setFrictionY(x)

Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving vertically in the Y axis. The higher than friction, the faster the body will slow down once force stops being applied to it.

Parameters:
Name Type Description
x number

The amount of friction to apply.

Since: 3.0.0
Source: src/physics/arcade/components/Friction.js (Line 52)
Returns:

This Game Object.

Type
Phaser.Physics.Arcade.Components.Friction