A virtual joystick control for touchscreen devices.
A customizable on-screen joystick control designed for touchscreen devices. It allows users to provide directional input by dragging a virtual tip within a defined circular area.
This control can simulate directional actions (see action_up, action_down, action_left, and action_right), which are triggered when the joystick is moved in the corresponding directions.
The multiplier applied to the joystick's radius that defines the clamp zone.
This zone limits how far the joystick tip can move from its center before being clamped.
A value of 1.0 means the tip can move up to the edge of the joystick's visual size.
In JOYSTICK_FOLLOWING mode, this radius also determines how far the finger can move before the joystick base starts following the touch input.
The ratio of the joystick size that defines the joystick deadzone. The joystick tip must move beyond this ratio before being considered active.
This deadzone is applied before triggering input actions and affects the joystick's input vector and all related signals.
Note that input actions may also define their own deadzones in the InputMap. If both are set, the joystick deadzone is applied first, followed by the action's deadzone.
By default, this value is 0.0, meaning the joystick does not apply its own deadzone and relies entirely on the InputMap action deadzones.
The initial position of the joystick as a ratio of the control's size. (0, 0) is top-left and (1, 1) is bottom-right.
Emitted when the tip moved outside the deadzone and the joystick is released. The input_vector contains the last input direction and strength before release. Its length is between 0.0 and 1.0.
Emitted when the joystick is released. The input_vector is the final input direction and strength, with a length between 0.0 and 1.0.
JOYSTICK_FIXED = 0The joystick doesn't move.
JOYSTICK_DYNAMIC = 1The joystick is moved to the initial touch position as long as it's within the joystick's bounds. It moves back to its original position when released.
JOYSTICK_FOLLOWING = 2The joystick is moved to the initial touch position as long as it's within the joystick's bounds. It will follow the touch input if it goes outside the joystick's range. It moves back to its original position when released.