Skip to main content

InputJoystick

Wolfram Kernel
Execution environment
Notebook`Kernel`Inputs`
Context
InputJoystick[] _EventObject

creates and instance of 2D manipulator (virtual joystick)

Event generation

It fires an event with {x_, y_} coordinates of a joystick in a range of [-1,1] once it has been dragged by a user.

Helpers

There is helper function to integrate the position, that joystick controls velocity instead of absolute position

InputJoystick`IntegrationHelper[initialValue_:{0,0}, delta_:0.01][callback_Function] _Function

for example

cell 1
pt = {0.,0.};

handler = InputJoystick`IntegrationHelper[][Function[xy,
pt = xy
]];

EventHandler[InputJoystick[], handler]
cell 2
Graphics[
{Red, PointSize[0.05], Point[pt // Offload]}
, PlotRange->{{-1,1}, {-1,1}}
]

Chaining events

One can reuse another event

InputJoystick[event_EventObject, rest___]

Options

No options are available

Supported output forms