VirtualJoystick

Class used to define virtual joystick (used in touch mode)

Hierarchy

  • VirtualJoystick

Index

Constructors

constructor

  • Creates a new virtual joystick

    Parameters

    • Optional leftJoystick: boolean

      defines that the joystick is for left hand (false by default)

    Returns VirtualJoystick

Properties

deltaPosition

deltaPosition: Vector3

Gets the offset value for the position (ie. the change of the position value)

pressed

pressed: boolean

Gets a boolean indicating if the virtual joystick was pressed

reverseLeftRight

reverseLeftRight: boolean

Gets or sets a boolean indicating that left and right values must be inverted

reverseUpDown

reverseUpDown: boolean

Gets or sets a boolean indicating that up and down values must be inverted

Methods

releaseCanvas

  • releaseCanvas(): void
  • Release internal HTML canvas

    Returns void

setActionOnTouch

  • setActionOnTouch(action: function): void
  • Defines a callback to call when the joystick is touched

    Parameters

    • action: function

      defines the callback

        • (): any
        • Returns any

    Returns void

setAxisForLeftRight

  • Defines which axis you'd like to control for left & right

    Parameters

    Returns void

setAxisForUpDown

  • Defines which axis you'd like to control for up & down

    Parameters

    Returns void

setJoystickColor

  • setJoystickColor(newColor: string): void
  • Change the color of the virtual joystick

    Parameters

    • newColor: string

      a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")

    Returns void

setJoystickSensibility

  • setJoystickSensibility(newJoystickSensibility: number): void
  • Defines joystick sensibility (ie. the ratio beteen a physical move and virtual joystick position change)

    Parameters

    • newJoystickSensibility: number

      defines the new sensibility

    Returns void

Generated using TypeDoc