Class: Axis

Phaser.Input.Gamepad. Axis

Contains information about a specific Gamepad Axis. Axis objects are created automatically by the Gamepad as they are needed.


new Axis(pad, index)

Parameters:
Name Type Description
pad Phaser.Input.Gamepad.Gamepad

A reference to the Gamepad that this Axis belongs to.

index number

The index of this Axis.

Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 9)

Members


events :Phaser.Events.EventEmitter

An event emitter to use to emit the axis events.

Type:
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 37)

index :number

The index of this Axis.

Type:
  • number
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 46)

pad :Phaser.Input.Gamepad.Gamepad

A reference to the Gamepad that this Axis belongs to.

Type:
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 28)

threshold :number

Movement tolerance threshold below which axis values are ignored in getValue.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0.1
Source: src/input/gamepad/Axis.js (Line 66)

value :number

The raw axis value, between -1 and 1 with 0 being dead center. Use the method getValue to get a normalized value with the threshold applied.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/input/gamepad/Axis.js (Line 55)

Methods


destroy()

Destroys this Axis instance and releases external references it holds.

Since: 3.10.0
Source: src/input/gamepad/Axis.js (Line 105)

getValue()

Applies the threshold value to the axis and returns it.

Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 92)
Returns:

The axis value, adjusted for the movement threshold.

Type
number