Search Results for

    Show / Hide Table of Contents

    Class Smooth

    Some helpful interpolation functionality.

    Inheritance
    System.Object
    Smooth
    Namespace: GDX.Mathematics
    Syntax
    [VisualScriptingCompatible((short)8)]
    public static class Smooth

    Methods

    | Improve this Doc View Source

    Exponential(Single, Single, Single, Single)

    Smooths between previousValue and targetValue based on time since the last sample and a given half-life.

    Declaration
    public static float Exponential(float previousValue, float targetValue, float halfLife, float elapsedTime = NaNF)
    Parameters
    Type Name Description
    System.Single previousValue

    Ideally, the previous output value.

    System.Single targetValue

    The target value.

    System.Single halfLife

    Half of the time it would take to go from previousValue to targetValue if time were constant.

    System.Single elapsedTime

    The amount of time that has transpired since the previousValue was generated.

    Returns
    Type Description
    System.Single

    A smoothed value.

    Remarks

    Assumes wibbly wobbly, timey wimey.

    | Improve this Doc View Source

    HalfLifeToSmoothingFactor(Single, Single)

    Takes a halfLife value, and outputs a factor based on elapsedTime.

    Declaration
    public static float HalfLifeToSmoothingFactor(float halfLife, float elapsedTime)
    Parameters
    Type Name Description
    System.Single halfLife

    The desired half-life.

    System.Single elapsedTime

    The time since the last sample.

    Returns
    Type Description
    System.Single

    The coefficient value applied to the weight(t) of a lerp.

    Remarks

    Not providing a value for elapsedTime will result in using Time.deltaTime.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Built on 2024-01-01 against 1f69a68.
    Generated by Dox+DocFX.