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 [member action_up], [member action_down], [member action_left], and [member action_right]), which are triggered when the joystick is moved in the corresponding directions.
- The action to trigger when the joystick is moved down.
- The action to trigger when the joystick is moved left.
- The action to trigger when the joystick is moved right.
- The action to trigger when the joystick is moved up.
- 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 [code]1.0[/code] means the tip can move up to the edge of the joystick's visual size. In [constant 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 [code]0.0[/code], 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. [code](0, 0)[/code] is top-left and [code](1, 1)[/code] is bottom-right.
- The joystick mode to use.
- The size of the joystick in pixels.
- The texture to use for the joystick base. When [code]null[/code], a ring is drawn using the [theme_item ring_normal_color] and [theme_item ring_pressed_color].
- The size of the joystick tip in pixels.
- The texture to use for the joystick tip. When [code]null[/code], a circle is drawn using the [theme_item tip_normal_color] and [theme_item tip_pressed_color].
- The visibility mode to use.
Emitted when the tip enters the deadzone after being outside of it.
Emitted when the tip moved outside the deadzone and the joystick is released. The [param input_vector] contains the last input direction and strength before release. Its length is between [code]0.0[/code] and [code]1.0[/code].
Emitted when the joystick is pressed.
Emitted when the joystick is released. The [param input_vector] is the final input direction and strength, with a length between [code]0.0[/code] and [code]1.0[/code].
Emitted when the joystick is released without moving the tip.
The joystick doesn't move.
The 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.
The 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.
The joystick is always visible.
The joystick is only visible when being touched.
Default ring joystick [Color].
Ring joystick [Color] when pressed.
Default Tip joystick [Color].
Tip joystick [Color] when pressed.