Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • VirtualJoystick

Index

Constructors

  • 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

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

Accessors

  • get alwaysVisible(): boolean
  • set alwaysVisible(value: boolean): void
  • 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 void

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

    Returns number

  • Size of the joystick's container

    Parameters

    • newSize: number

    Returns void

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

    Returns number

  • Size of the joystick's puck

    Parameters

    • newSize: number

    Returns void

Methods

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

    Returns void

  • releaseCanvas(): void
  • Release internal HTML canvas

    Returns void

  • 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

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

    Parameters

    Returns void

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

    Parameters

    Returns void

  • 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

  • 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(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

  • 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

  • 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
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static property
  • Static method

Settings

Theme