InputModifier
Inherits: Resource < Shared < Object
Inherited by: InputModifierDeadZone, InputModifierNegate, InputModifierResponseCurveExponential, InputModifierScalar, InputModifierScaleByDeltaTime, InputModifierSmooth, InputModifierSwizzle
Base class of the modifiers that change an input value before it reaches its action.
Description
Section titled “Description”A modifier changes the value of one key, on an InputMapping, or the value of an InputAction once the values of all its keys are combined. Modifiers run in the order of their array: InputMapping.modifiers for one key, then InputAction.modifiers for the action. Then the action’s triggers decide whether it fires, from the modified value.
Typical uses: flip a key’s sign with InputModifierNegate, make a key drive the Y axis of a 2D action with InputModifierSwizzle, ignore stick drift with InputModifierDeadZone, set the mouse sensitivity with InputModifierScalar, make a rate independent of the frame rate with InputModifierScaleByDeltaTime, bend a stick’s response with InputModifierResponseCurveExponential, or smooth it over a few frames with InputModifierSmooth.
Values are Vector3 internally: a Bool or Axis 1D action uses X, an Axis 2D action X and Y, an Axis 3D action all three. A key’s value is cut to the action’s InputAction.value_type before its modifiers run and again after them, so on a Bool or Axis 1D action only X reaches the modifiers (the Y of a stick can’t be swizzled into it).
A modifier resource can be shared by several mappings, actions and contexts: what a modifier remembers between frames (the samples of InputModifierSmooth) is kept by EnhancedInput for each mapping or action that uses it.
This class is abstract: use the modifiers above. Modifiers can’t be written in Grost.