RealDocs

UBlueprintSpringMathLibrary::DampFloat

function Engine Blueprint Since 5.7
#include "Kismet/BlueprintSpringMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Smooths Value towards Target using exponential damping, returning the new smoothed value each call. Unlike the spring functions, this is stateless and pure — there is no velocity to track.

Caveats & Gotchas

  • Marked UE_EXPERIMENTAL(5.7, "SpringMath is experimental") — behaviour and defaults may change in later engine versions.
  • Being BlueprintPure and stateless, the caller must feed the previous frame's return value back in as Value on the next call to get continuous smoothing — this function does not persist any state internally.
  • Exponential damping has no overshoot but also no springiness; if you need the value to overshoot and settle (bounce), use CriticalSpringDampFloat instead.

Signature

static float DampFloat(float Value, float Target, float DeltaTime, float SmoothingTime = 0.2f);

Parameters

Name Type Description Default
Value float The value to be smoothed.
Target float The target to smooth towards.
DeltaTime float Time interval in seconds.
SmoothingTime float Timescale over which to smooth. Larger values give more smoothed behaviour; can be zero. 0.2f

Return Type

float

Example

Smooth a value frame-to-frame C++
float SmoothedValue = 0.f;

void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    SmoothedValue = UBlueprintSpringMathLibrary::DampFloat(SmoothedValue, TargetValue, DeltaTime, 0.2f);
}

Version History

Introduced in: 5.7

Version Status Notes
5.7 experimental SpringMath is experimental.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.