API

Class VirtualJoystick

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

Index
  • Creates a new virtual joystick

    Parameters

    • OptionalleftJoystick: boolean

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

    • Optionalcustomizations: Partial<IVirtualJoystickCustomizations>

      Defines the options we want to customize the VirtualJoystick

    Returns VirtualJoystick

deltaPosition: Vector3

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

limitToContainer: boolean

boolean indicating whether or not the joystick's puck's movement should be limited to the joystick's container area

pressed: boolean

Gets a boolean indicating if the virtual joystick was pressed

reverseLeftRight: boolean

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

reverseUpDown: boolean

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

Canvas: Nullable<HTMLCanvasElement>

Canvas the virtual joystick will render onto, default z-index of this is 5

  • 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

  • Defines joystick sensibility (ie. the ratio between a physical move and virtual joystick position change)

    Parameters

    • newJoystickSensibility: number

      defines the new sensibility

    Returns void