Class PS4Controller

The PS4Controller class models a single PS4 controller connected to the computer, providing ButtonInput & SliderInput properties for the various inputs on the controller.

Hierarchy

  • PS4Controller

Implements

Constructors

Accessors

  • get L2(): ButtonInput
  • ButtonInput for L2. Supports pressure sensitivity.

    Returns ButtonInput

  • get L3(): ButtonInput
  • ButtonInput for L3 (when you push in the left analog stick).

    Returns ButtonInput

  • get L3_X(): SliderInput
  • SliderInput for the X-axis of the left analog stick. -1 = fully left, +1 = fully right

    Returns SliderInput

  • get L3_Y(): SliderInput
  • SliderInput for the Y-axis of the left analog stick. -1 = fully up, +1 = fully down

    Returns SliderInput

  • get L3_magnitude(): SliderInput
  • How far away from center the L3 analog stick is. Value ranges from 0 to 1.

    Returns SliderInput

  • get L3_rotation(): SliderInput
  • The angle of the L3 analog stick, measured clockwise in degrees from the stick pointing directly upwards. Values fall in the range (-180, 180]

    Returns SliderInput

  • get R2(): ButtonInput
  • ButtonInput for R2. Supports pressure sensitivity.

    Returns ButtonInput

  • get R3(): ButtonInput
  • ButtonInput for R3 (when you push in the right analog stick).

    Returns ButtonInput

  • get R3_X(): SliderInput
  • SliderInput for the X-axis of the right analog stick. -1 = fully left, +1 = fully right

    Returns SliderInput

  • get R3_Y(): SliderInput
  • SliderInput for the Y-axis of the right analog stick. -1 = fully up, +1 = fully down

    Returns SliderInput

  • get R3_magnitude(): SliderInput
  • How far away from center the R3 analog stick is. Value ranges from 0 to 1.

    Returns SliderInput

  • get R3_rotation(): SliderInput
  • The angle of the R3 analog stick, measured clockwise in degrees from the stick pointing directly upwards. Values fall in the range (-180, 180]

    Returns SliderInput

  • get axes(): SliderInput[]
  • The collection of all axes on the gamepad.

    Returns SliderInput[]

  • get buttons(): ButtonInput[]
  • The collection of all buttons on the gamepad.

    Returns ButtonInput[]

  • get down(): ButtonInput
  • ButtonInput for Down on the D-Pad.

    Returns ButtonInput

  • get left(): ButtonInput
  • ButtonInput for Left on the D-Pad.

    Returns ButtonInput

  • get right(): ButtonInput
  • ButtonInput for Right on the D-Pad.

    Returns ButtonInput

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

Methods

  • Checks if the passed in Gamepad API object can be matched to this PS4 controller, requiring that it have 16 buttons & 4 axes.

    Returns

    Parameters

    • gamepadObject: Gamepad

      The Gamepad API object to potentially be matched to.

    Returns boolean

  • Automatically called by the system, shouldn't be called by consumers of the library. Updates each button and slider on the controller.

    Parameters

    • deltaMs: number

      How many milliseconds since the last update cycle

    Returns void

Generated using TypeDoc