reckfellENGINE

VirtualJoystick

Touchscreen joystick driving Input actions.

On this page
class VirtualJoystickReckfellSharpInherits Control

VirtualJoystick receives ScreenTouch/ScreenDrag within its Control area and owns one touch index. Configure four Input Map actions before use and read them in movement logic. Not a physical-gamepad driver; a mouse needs conversion to touch events.

Control size defines the touch activation area; JoystickSize defines the base size. Use positive JoystickSize and ClampzoneRatio, with DeadzoneRatio at least zero and strictly below one. Released/Flicked carry the last processed vector before reset.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

VirtualJoystickConstructor
# VirtualJoystick
C#
public VirtualJoystick();

Creates a touch joystick. Add to UI and configure its Control area/actions before touches. Construction does not create Input Map actions.

Properties11

ActionDownProperty
# ActionDown
C#
public StringName ActionDown { get; set; }

Input Map action for the positive Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

ActionLeftProperty
# ActionLeft
C#
public StringName ActionLeft { get; set; }

Input Map action for the negative X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

ActionRightProperty
# ActionRight
C#
public StringName ActionRight { get; set; }

Input Map action for the positive X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

ActionUpProperty
# ActionUp
C#
public StringName ActionUp { get; set; }

Input Map action for the negative Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

ClampzoneRatioProperty
# ClampzoneRatio
C#
public float ClampzoneRatio { get; set; }

Multiplier of the JoystickSize / 2 radius where output reaches full amplitude. Must be > zero: zero causes division by zero during input processing. The setter does not clamp programmatic values; configure before holding.

DeadzoneRatioProperty
# DeadzoneRatio
C#
public float DeadzoneRatio { get; set; }

Fraction of clamp radius producing no movement. Use zero <= ratio < one. Beyond it, amplitude is remapped from zero to one; not a screen-width fraction. The setter does not clamp programmatic values.

InitialOffsetRatioProperty
# InitialOffsetRatio
C#
public Vector2 InitialOffsetRatio { get; set; }

Initial center as Control Size × ratio on each axis; (0.5, 0.5) is the center. Not a pixel offset. Changing it resets touch/actions; resizing the Control also resets the joystick.

JoystickModeProperty
# JoystickMode
C#
public VirtualJoystick.JoystickModeEnum JoystickMode { get; set; }

Fixed uses the original center and accepts touch starts within the base rectangle. Dynamic centers at touch start inside the Control. Following also moves the center when the finger exceeds the clamp radius while inside the Control. Does not set visibility.

JoystickSizeProperty
# JoystickSize
C#
public float JoystickSize { get; set; }

Base size in pixels, with control radius based on Size / 2. Use a positive value. Changing it resets the current touch/actions; not the full Control activation area.

TipSizeProperty
# TipSize
C#
public float TipSize { get; set; }

Knob size in pixels rather than output amplitude. Changing it resets the current touch/actions. Use a positive value.

VisibilityModeProperty
# VisibilityMode
C#
public VirtualJoystick.VisibilityModeEnum VisibilityMode { get; set; }

Always draws the joystick continuously; WhenTouched skips drawing without an active touch during play. A drawing mode rather than Visible false: the input area remains. It stays visible in the editor for configuration.

Methods22

GetActionDownStringName
# GetActionDown
C#
public StringName GetActionDown();

Input Map action for the positive Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Returns StringName

Input Map action for the positive Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

GetActionLeftStringName
# GetActionLeft
C#
public StringName GetActionLeft();

Input Map action for the negative X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Returns StringName

Input Map action for the negative X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

GetActionRightStringName
# GetActionRight
C#
public StringName GetActionRight();

Input Map action for the positive X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Returns StringName

Input Map action for the positive X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

GetActionUpStringName
# GetActionUp
C#
public StringName GetActionUp();

Input Map action for the negative Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Returns StringName

Input Map action for the negative Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

GetClampzoneRatiofloat
# GetClampzoneRatio
C#
public float GetClampzoneRatio();

Multiplier of the JoystickSize / 2 radius where output reaches full amplitude. Must be > zero: zero causes division by zero during input processing. The setter does not clamp programmatic values; configure before holding.

Returns float

Multiplier of the JoystickSize / 2 radius where output reaches full amplitude. Must be > zero: zero causes division by zero during input processing. The setter does not clamp programmatic values; configure before holding.

GetDeadzoneRatiofloat
# GetDeadzoneRatio
C#
public float GetDeadzoneRatio();

Fraction of clamp radius producing no movement. Use zero <= ratio < one. Beyond it, amplitude is remapped from zero to one; not a screen-width fraction. The setter does not clamp programmatic values.

Returns float

Fraction of clamp radius producing no movement. Use zero <= ratio < one. Beyond it, amplitude is remapped from zero to one; not a screen-width fraction. The setter does not clamp programmatic values.

GetInitialOffsetRatioVector2
# GetInitialOffsetRatio
C#
public Vector2 GetInitialOffsetRatio();

Initial center as Control Size × ratio on each axis; (0.5, 0.5) is the center. Not a pixel offset. Changing it resets touch/actions; resizing the Control also resets the joystick.

Returns Vector2

Initial center as Control Size × ratio on each axis; (0.5, 0.5) is the center. Not a pixel offset. Changing it resets touch/actions; resizing the Control also resets the joystick.

GetJoystickModeVirtualJoystick.JoystickModeEnum
# GetJoystickMode
C#
public VirtualJoystick.JoystickModeEnum GetJoystickMode();

Fixed uses the original center and accepts touch starts within the base rectangle. Dynamic centers at touch start inside the Control. Following also moves the center when the finger exceeds the clamp radius while inside the Control. Does not set visibility.

Returns VirtualJoystick.JoystickModeEnum

Fixed uses the original center and accepts touch starts within the base rectangle. Dynamic centers at touch start inside the Control. Following also moves the center when the finger exceeds the clamp radius while inside the Control. Does not set visibility.

GetJoystickSizefloat
# GetJoystickSize
C#
public float GetJoystickSize();

Base size in pixels, with control radius based on Size / 2. Use a positive value. Changing it resets the current touch/actions; not the full Control activation area.

Returns float

Base size in pixels, with control radius based on Size / 2. Use a positive value. Changing it resets the current touch/actions; not the full Control activation area.

GetTipSizefloat
# GetTipSize
C#
public float GetTipSize();

Knob size in pixels rather than output amplitude. Changing it resets the current touch/actions. Use a positive value.

Returns float

Knob size in pixels rather than output amplitude. Changing it resets the current touch/actions. Use a positive value.

GetVisibilityModeVirtualJoystick.VisibilityModeEnum
# GetVisibilityMode
C#
public VirtualJoystick.VisibilityModeEnum GetVisibilityMode();

Always draws the joystick continuously; WhenTouched skips drawing without an active touch during play. A drawing mode rather than Visible false: the input area remains. It stays visible in the editor for configuration.

Returns VirtualJoystick.VisibilityModeEnum

Always draws the joystick continuously; WhenTouched skips drawing without an active touch during play. A drawing mode rather than Visible false: the input area remains. It stays visible in the editor for configuration.

SetActionDownvoid
# SetActionDown
C#
public void SetActionDown(StringName action);

Input Map action for the positive Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Parameters
NameTypeDefault
actionStringName—
action

Name of a previously defined Input Map action.

SetActionLeftvoid
# SetActionLeft
C#
public void SetActionLeft(StringName action);

Input Map action for the negative X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Parameters
NameTypeDefault
actionStringName—
action

Name of a previously defined Input Map action.

SetActionRightvoid
# SetActionRight
C#
public void SetActionRight(StringName action);

Input Map action for the positive X component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Parameters
NameTypeDefault
actionStringName—
action

Name of a previously defined Input Map action.

SetActionUpvoid
# SetActionUp
C#
public void SetActionUp(StringName action);

Input Map action for the negative Y component, with strength from processed output. Define it before input. Configure before holding: changing the name does not automatically release the old action. Coordinate virtual sources sharing actions because the joystick calls action_press/action_release.

Parameters
NameTypeDefault
actionStringName—
action

Name of a previously defined Input Map action.

SetClampzoneRatiovoid
# SetClampzoneRatio
C#
public void SetClampzoneRatio(float ratio);

Multiplier of the JoystickSize / 2 radius where output reaches full amplitude. Must be > zero: zero causes division by zero during input processing. The setter does not clamp programmatic values; configure before holding.

Parameters
NameTypeDefault
ratiofloat—
ratio

Ratio for the corresponding zone; see the setting’s valid conditions.

SetDeadzoneRatiovoid
# SetDeadzoneRatio
C#
public void SetDeadzoneRatio(float ratio);

Fraction of clamp radius producing no movement. Use zero <= ratio < one. Beyond it, amplitude is remapped from zero to one; not a screen-width fraction. The setter does not clamp programmatic values.

Parameters
NameTypeDefault
ratiofloat—
ratio

Ratio for the corresponding zone; see the setting’s valid conditions.

SetInitialOffsetRatiovoid
# SetInitialOffsetRatio
C#
public void SetInitialOffsetRatio(Vector2 ratio);

Initial center as Control Size × ratio on each axis; (0.5, 0.5) is the center. Not a pixel offset. Changing it resets touch/actions; resizing the Control also resets the joystick.

Parameters
NameTypeDefault
ratioVector2—
ratio

Ratio for the corresponding zone; see the setting’s valid conditions.

SetJoystickModevoid
# SetJoystickMode
C#
public void SetJoystickMode(VirtualJoystick.JoystickModeEnum mode);

Fixed uses the original center and accepts touch starts within the base rectangle. Dynamic centers at touch start inside the Control. Following also moves the center when the finger exceeds the clamp radius while inside the Control. Does not set visibility.

Parameters
NameTypeDefault
modeVirtualJoystick.JoystickModeEnum—
mode

Joystick positioning or visibility mode according to the argument type.

SetJoystickSizevoid
# SetJoystickSize
C#
public void SetJoystickSize(float size);

Base size in pixels, with control radius based on Size / 2. Use a positive value. Changing it resets the current touch/actions; not the full Control activation area.

Parameters
NameTypeDefault
sizefloat—
size

Positive base/knob size in pixels.

SetTipSizevoid
# SetTipSize
C#
public void SetTipSize(float size);

Knob size in pixels rather than output amplitude. Changing it resets the current touch/actions. Use a positive value.

Parameters
NameTypeDefault
sizefloat—
size

Positive base/knob size in pixels.

SetVisibilityModevoid
# SetVisibilityMode
C#
public void SetVisibilityMode(VirtualJoystick.VisibilityModeEnum mode);

Always draws the joystick continuously; WhenTouched skips drawing without an active touch during play. A drawing mode rather than Visible false: the input area remains. It stays visible in the editor for configuration.

Parameters
NameTypeDefault
modeVirtualJoystick.VisibilityModeEnum—
mode

Joystick positioning or visibility mode according to the argument type.

Signals and events5

FlickCanceledEvent
# FlickCanceled
C#
public event Action FlickCanceled;

Moving from nonzero input back into the deadzone marks the flick canceled. Not an OS touch-cancellation event. Leaving the deadzone again can re-enable a flick.

FlickedEvent
# Flicked
C#
public event VirtualJoystick.FlickedEventHandler Flicked;

On release after dragging with nonzero output, emits the last processed vector. Does not calculate gesture velocity or throw impulse; calculate those separately if needed.

Handler parameters
NameTypeDefault
inputVectorVector2—
inputVector

Last processed vector: X rightward, Y downward; length up to one with valid settings.

PressedEvent
# Pressed
C#
public event Action Pressed;

An accepted touch starts. The control handles one touch index; extra touches do not become another independent stick in the same control.

ReleasedEvent
# Released
C#
public event VirtualJoystick.ReleasedEventHandler Released;

Emits the last deadzone-processed vector on release, before resetting to zero. Final touch output rather than a continuous movement event. Tapped or Flicked may follow immediately.

Handler parameters
NameTypeDefault
inputVectorVector2—
inputVector

Last processed vector: X rightward, Y downward; length up to one with valid settings.

TappedEvent
# Tapped
C#
public event Action Tapped;

Emitted on release without ScreenDrag and without a canceled flick state. Hold duration is not limited; not restricted to a short tap.

VirtualJoystick.JoystickModeEnum

ValueDescription
Dynamic = 1

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.

Fixed = 0

The joystick doesn't move.

Following = 2

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.

VirtualJoystick.VisibilityModeEnum

ValueDescription
Always = 0

The joystick is always visible.

WhenTouched = 1

The joystick is only visible when being touched.

Theme properties

These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.

Key and typeDescription
normal_joystick
StyleBox

Base joystick StyleBox.

normal_tip
StyleBox

Tip joystick StyleBox.

pressed_joystick
StyleBox

Base joystick StyleBox when pressed.

pressed_tip
StyleBox

Tip joystick StyleBox when pressed.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.