Class VirtualAxis

The VirtualAxis class implements an abstract HID axis.

Hierarchy

  • FrameworkObject
    • VirtualAxis

Constructors

  • Creates a new virtual button registered with a single ButtonCode.

    Parameters

    • name: string

      Unique name used to access the virtual button.

    • type: EnumValue<InputAxis, number>
    • OptionaldeadZone: number
    • Optionalsensitivity: number
    • Optionalinvert: boolean
    • Optionalcategory: string

      The category of the button, if undefined, the default category will be used.

    • OptionalisInternalConstructor: boolean

    Returns VirtualAxis

    The newly created button.

    The button must registered with an InputConfiguration to become active and start emitting events.

    Each category only support each name uniquely per ButtonCode.

Accessors

  • get category(): string
  • Gets the category of the button.

    Returns string

  • get deadZone(): number
  • Value below which to ignore virtualAxis value and consider it 0.

    Returns number

  • get id(): UUID
  • Gets the ID of the button.

    Returns UUID

  • get isInverted(): boolean
  • Should the virtualAxis be inverted.

    Returns boolean

  • get isNormalized(): boolean
  • If enabled, virtualAxis values will be normalized to [-1, 1] range. Most axes already come in normalized form and this value will not affect such axes. Some axes, like mouse movement are not normalized by default and will instead report relative movement. By enabling this you will normalize such axes to [-1, 1] range.

    Returns boolean

  • get name(): string
  • Gets the name of the button.

    Returns string

  • get sensitivity(): number
  • Higher sensitivity means the virtualAxis will more easily reach its maximum values.

    Returns number

  • get type(): EnumValue<InputAxis, number>
  • Type of physical virtualAxis to map to. See InputAxis type for common types, but you are not limited to those values.

    Returns EnumValue<InputAxis, number>

Methods

  • Returns normalized value for the specified input axis. Returned value will usually be in [-1.0, 1.0] range, but can be outside the range for devices with unbound axes (for example mouse).

    Parameters

    • OptionaldeviceIndex: number

      Optional device index in case multiple input devices are available.

    Returns number