Options
All
  • Public
  • Public/Protected
  • All
Menu

Class 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)

    • Optional customizations: Partial<VirtualJoystickCustomizations>

      Defines the options we want to customize the VirtualJoystick

    Returns VirtualJoystick

Properties

deltaPositionSearch playground for deltaPosition

deltaPosition: Vector3

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

limitToContainerSearch playground for limitToContainer

limitToContainer: boolean

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

pressedSearch playground for pressed

pressed: boolean

Gets a boolean indicating if the virtual joystick was pressed

reverseLeftRightSearch playground for reverseLeftRight

reverseLeftRight: boolean

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

reverseUpDownSearch playground for reverseUpDown

reverseUpDown: boolean

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

Static CanvasSearch playground for Canvas

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

Accessors

alwaysVisible

  • get alwaysVisible(): boolean
  • set alwaysVisible(value: boolean): any
  • Defines whether or not the joystick container is always visible

    Returns boolean

  • Defines whether or not the joystick container is always visible

    Parameters

    • value: boolean

    Returns any

containerSize

  • get containerSize(): number
  • set containerSize(newSize: number): any
  • Size of the joystick's container

    Returns number

  • Size of the joystick's container

    Parameters

    • newSize: number

    Returns any

puckSize

  • get puckSize(): number
  • set puckSize(newSize: number): any
  • Size of the joystick's puck

    Returns number

  • Size of the joystick's puck

    Parameters

    • newSize: number

    Returns any

Methods

clearPositionSearch playground for clearPosition

  • clearPosition(): void
  • Clears the set position of the joystick

    Returns void

releaseCanvasSearch playground for releaseCanvas

  • releaseCanvas(): void
  • Release internal HTML canvas

    Returns void

setActionOnTouchSearch playground for setActionOnTouch

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

    Parameters

    • action: () => any

      defines the callback

        • (): any
        • Returns any

    Returns void

setAxisForLeftRightSearch playground for setAxisForLeftRight

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

    Parameters

    Returns void

setAxisForUpDownSearch playground for setAxisForUpDown

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

    Parameters

    Returns void

setContainerImageSearch playground for setContainerImage

  • setContainerImage(urlPath: string): void
  • Loads urlPath to be used for the container's image

    Parameters

    • urlPath: string

      defines the urlPath of an image to use

    Returns void

setJoystickColorSearch playground for 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

setJoystickSensibilitySearch playground for setJoystickSensibility

  • setJoystickSensibility(newJoystickSensibility: number): 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

setPositionSearch playground for setPosition

  • setPosition(x: number, y: number): void
  • Sets the constant position of the Joystick container

    Parameters

    • x: number

      X axis coordinate

    • y: number

      Y axis coordinate

    Returns void

setPuckImageSearch playground for setPuckImage

  • setPuckImage(urlPath: string): void
  • Loads urlPath to be used for the puck's image

    Parameters

    • urlPath: string

      defines the urlPath of an image to use

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method