Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/SpringMath
Description
A velocity spring will damp towards a target that follows a fixed linear target velocity, allowing control of the interpolation speed while still giving a smoothed behaviour. A SmoothingTime of 0 will give a linear interpolation between X and TargetX
| Name | VelocitySpringDamper |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Public/Animation/SpringMath.h |
| Include Path | #include "Animation/SpringMath.h" |
template<typename TVector>
static void VelocitySpringDamper
(
TVector & InOutX,
TVector & InOutV,
TVector & InOutXi,
TVector TargetX,
float MaxSpeed,
float SmoothingTime,
float DeltaTime
)
Parameters
| Name | Remarks |
|---|---|
| TVector | The type of vector to use (e.g. FVector2D, FVector4, FVector etc) |
| InOutX | The value to be damped |
| InOutV | The velocity of the value to be damped |
| InOutXi | The intermediate target of the value to be damped |
| TargetX | The target value of X to damp towards |
| MaxSpeed | The max velocity to use for the intermediate target interpolation |
| SmoothingTime | The smoothing time to use while damping towards X. Higher values will give more smoothed behaviour. A value of 0 will give a linear interpolation of X to Target |
| DeltaTime | The timestep in seconds |