Skip to content
InputForge

Modifiers

Modifiers transform the raw Vector3 value produced by an InputKey before it reaches trigger evaluation. They are applied in array order — the output of each modifier is the input of the next.

Assign modifiers to an InputMapping via the LocalModifiers array in the Inspector.


Returns Vector3.Zero when the value’s length is below the threshold. Use this to eliminate analog stick drift.

PropertyDefaultDescription
Deadzone0.2Minimum length required to pass through

Place this first in the modifier list so downstream modifiers receive clean values.


Negates selected axes.

PropertyDefaultDescription
InvertXtrueNegate the X axis
InvertYfalseNegate the Y axis
InvertZfalseNegate the Z axis

Common use: inverting a joystick Y axis, reversing scroll direction.


Scales the vector to unit length (magnitude 1). Values with squared length below MinValueThreshold are clamped to zero, preventing unexpected direction snapping on release.

PropertyDefaultDescription
MinValueThreshold0.001Values below this (squared) are treated as zero

Use on Digital Axis2D mappings to keep diagonal movement the same speed as cardinal movement.

Place after DeadzoneModifier — normalizing before deadzone filtering can amplify drift to full magnitude.


Multiplies each axis by a per-axis scale factor.

PropertyDefaultDescription
ScaleVector3.OnePer-axis multiplier

Use for sensitivity adjustment or weighting one axis differently from another.


Reorders the axes of the value vector.

PropertyDefaultDescription
OrderYXZThe new axis order to apply

Available orders:

OrderResultCommon use
YXZ(Y, X, Z) — swap X and YMap horizontal mouse to vertical look
XZY(X, Z, Y) — swap Y and Z
ZYX(Z, Y, X) — swap X and Z
ZXY(Z, X, Y)
YZX(Y, Z, X)

Reinterprets a Pointer value (which arrives as raw viewport-local pixel coordinates) into a different coordinate space.

PropertyDefaultDescription
SpaceScreenSpaceHow to reinterpret the pointer position (see below)
TargetRectThe reference Rect2 used when Space = RelativeToRect

Space values:

ValueResult
ScreenSpaceGlobal desktop coordinates across the whole virtual screen (raw pixels).
RelativeToScreenNormalized 0–1 position relative to the primary screen resolution.
RelativeToRectNormalized 0–1 position relative to TargetRect(0,0) top-left, (1,1) bottom-right. Values outside the rect are not clamped.

Use with a Pointer InputKey to get cursor positions in the space your gameplay or UI logic actually needs.


Extend InputModifier and override Apply:

using Godot;
using InputForge.Modifiers;
[GlobalClass]
public partial class ClampModifier : InputModifier
{
[Export] public float Max { get; set; } = 1.0f;
public override Vector3 Apply(Vector3 value)
=> new(
Mathf.Clamp(value.X, -Max, Max),
Mathf.Clamp(value.Y, -Max, Max),
Mathf.Clamp(value.Z, -Max, Max)
);
}