It is small library to emulate a virtual joystick for touchscreen. For details, see "Let’s Make a 3D Game: Virtual Joystick" post on "learningthreejs blog".
You can install it manually. Just do
<script src='virtualjoystick.js'></script>
You can install with bower.
bower install virtualjoystick.js
then you add that in your html
<script src="https://github.com/jeromeetienne/virtualjoystick.js/raw/master/bower_components/virtualjoystick.js/virtualjoystick.js"></script>
opts.container
is the
dom element
on which we display joystickopts.stickElement
is the
dom element
which is display for the stick of the joystick.opts.baseElement
is the
dom element
which is display for its base.opts.mouseSupport
to true during debug.opts.stationaryBase
to true for a permanent Stationary joystick base.opts.baseX
to the desired X-coordinate on the webpage and opts.baseY
to the desired Y-coordinate. The joystick base will now be fixed at this location.opts.limitStickTravel
to true in order to limit the distance that the stick can travel from its base. This will create an invisible circle barrier that the stick cannot leave. opts.limitStickTravel
, you can also set opts.stickRadius
to the desired radius (in pixels). The stick will now be confined to stickRadius. If you do not set opts.stickRadius
, it will default to 100 pixels radius.