RealDocs

FMath::SpringDamperSmoothing

function Core Since 4.26
#include "Math/UnrealMathUtility.h"
Access: public Specifiers: static

Description

Convenience wrapper around SpringDamper that accepts a SmoothingTime instead of a frequency, matching the CriticallyDampedSmoothing API but adding a tunable damping ratio.

Caveats & Gotchas

  • Internally derives undamped frequency as 1 / (PI * InSmoothingTime), so accuracy holds when InDeltaTime < 0.5 * InSmoothingTime — same constraint as CriticallyDampedSmoothing.
  • If InSmoothingTime is near zero, the value snaps to target immediately and InOutValueRate is set to the instantaneous velocity estimate. Guard against very small SmoothingTime values if you pass it from a UI slider.
  • This is a direct convenience wrapper — if you call this and SpringDamper in the same codebase, prefer picking one style for consistency.

Signature

template< class T >
static void SpringDamperSmoothing(T& InOutValue, T& InOutValueRate, const T& InTargetValue, const T& InTargetValueRate, const float InDeltaTime, const float InSmoothingTime, const float InDampingRatio)

Parameters

Name Type Description Default
InOutValue T& The value to be smoothed. Modified in place.
InOutValueRate T& Rate of change of the value. Modified in place — persist between frames.
InTargetValue const T& The target to smooth towards.
InTargetValueRate const T& The target rate of change.
InDeltaTime const float Elapsed time since last update.
InSmoothingTime const float Timescale over which to smooth — equivalent to the smoothing time in CriticallyDampedSmoothing.
InDampingRatio const float 1.0 = critical damping. <1 = underdamped (overshoot). >1 = overdamped.

Return Type

void

Example

Drop-in replacement for CriticallyDampedSmoothing with added bounce C++
// Same call site as CriticallyDampedSmoothing but with InDampingRatio = 0.8 for slight bounce
FMath::SpringDamperSmoothing(
    CurrentFOV, FOVRate,
    TargetFOV, 0.f,
    DeltaTime,
    0.2f,  // 200ms smoothing time
    0.8f   // slightly underdamped
);

Version History

Introduced in: 4.26

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.