CLASSES
TagsA - Z

VirtualJoystick

Description

class VirtualJoystick

Mainly based on these 2 articles :

Creating an universal virtual touch joystick working for all Touch models thanks to Hand.JS

& on Seb Lee-Delisle original work: http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/

Constructor

new VirtualJoystick(leftJoystick)

The VirtualJoystick constructor

Parameters

Name Type Description
optional leftJoystick boolean @param leftJoystick

Members

reverseLeftRight : boolean

True if the VirtualJoystick is reversed to right or left position, false otherwise.

Default value : false

reverseUpDown : boolean

True if the VirtualJoystick is reversed to top or bottom position, false otherwise.

Default value : false

deltaPosition : Vector3

Default value : Vector3.Zero

pressed : boolean

True is VirtualJoystick is pressed, false otherwise.

Methods

setJoystickSensibility(newJoystickSensibility) void

Parameters

Name Type Description
newJoystickSensibility number @param newJoystickSensibility

setJoystickColor(newColor) void

Change the color of the virtual joystick

Parameters

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

setActionOnTouch(action) void

Set the action for the button touched

Parameters

Name Type Description
action () => any @param action

setAxisForLeftRight(axis) void

Set the axis for the left and the right

Parameters

Name Type Description
axis JoystickAxis The given axis

setAxisForUpDown(axis) void

Set the axis for the up and the down

Parameters

Name Type Description
axis JoystickAxis The given axis

releaseCanvas() void