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 SourceExponential(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 |
| System.Single | elapsedTime | The amount of time that has transpired since the |
Returns
| Type | Description |
|---|---|
| System.Single | A smoothed value. |
Remarks
Assumes wibbly wobbly, timey wimey.
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.