docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NormalizeProcessor

    Normalizes input values in the range min and max to unsigned normalized form [0..1] if zero is placed at (or below) min or to signed normalized form [-1..1] if zero is placed in-between min and max.

    Inheritance
    object
    InputProcessor
    InputProcessor<float>
    NormalizeProcessor
    Inherited Members
    InputProcessor<float>.ProcessAsObject(object, InputControl)
    InputProcessor<float>.Process(void*, int, InputControl)
    InputProcessor.cachingPolicy
    Namespace: UnityEngine.InputSystem.Processors
    Assembly: Unity.InputSystem.dll
    Syntax
    public class NormalizeProcessor : InputProcessor<float>
    Remarks

    This processor is registered (see RegisterProcessor<T>(string)) under the name "normalize".

    Note that this processor does not clamp the incoming value to min and max. To achieve this, either add a ClampProcessor or use AxisDeadzoneProcessor which combines clamping and normalizing.

    // Bind to right trigger on gamepad such that the value values below 0.3 and above 0.7 get normalized // to values between [0..1]. new InputAction(binding: "<Gamepad>/rightTrigger", processors: "normalize(min=0.3,max=0.7)");

    Fields

    max

    Input value (inclusive) that corresponds to 1, the upper bound.

    Declaration
    public float max
    Field Value
    Type Description
    float
    Remarks

    If the input value goes beyond max, the result is undefined.

    See Also
    NormalizeVector2Processor
    NormalizeVector3Processor

    min

    Input value (inclusive) that corresponds to 0 or -1 (depending on zero), the lower bound.

    Declaration
    public float min
    Field Value
    Type Description
    float
    Remarks

    If the input value drops below min, the result is undefined.

    See Also
    NormalizeVector2Processor
    NormalizeVector3Processor

    zero

    Input value that corresponds to 0. If this is placed at or below min, the resulting normalization returns a [0..1] value. If this is placed in-between min and max, the resulting normalization returns a [-1..1] value.

    Declaration
    public float zero
    Field Value
    Type Description
    float
    See Also
    NormalizeVector2Processor
    NormalizeVector3Processor

    Methods

    Normalize(float, float, float, float)

    Normalize value with respect to min and max.

    Declaration
    public static float Normalize(float value, float min, float max, float zero)
    Parameters
    Type Name Description
    float value

    Input value.

    float min

    Lower bound. See min.

    float max

    Upper bound. See max.

    float zero

    Zero point. See zero.

    Returns
    Type Description
    float

    Normalized value.

    Remarks

    This method performs the same function as Process(float, InputControl).

    // Normalize 2 against a [1..5] range. Returns 0.25.
    NormalizeProcessor.Normalize(2, 1, 5, 1)
    See Also
    NormalizeVector2Processor
    NormalizeVector3Processor

    Process(float, InputControl)

    Normalize value with respect to min and max.

    Declaration
    public override float Process(float value, InputControl control)
    Parameters
    Type Name Description
    float value

    Input value.

    InputControl control

    Ignored.

    Returns
    Type Description
    float

    Normalized value.

    Overrides
    InputProcessor<float>.Process(float, InputControl)
    See Also
    NormalizeVector2Processor
    NormalizeVector3Processor

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    See Also
    NormalizeVector2Processor
    NormalizeVector3Processor

    See Also

    NormalizeVector2Processor
    NormalizeVector3Processor
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)