RealDocs

UBlueprintSpringMathLibrary::DampVector2D

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

Description

Smooths a 2D vector Value towards Target using exponential damping, returning the new smoothed value each call. Commonly used for 2D input like joystick deflection or UI positions where no separate velocity needs to be tracked.

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 — this function does not persist any state internally.
  • Exponential damping has no overshoot; if you need a spring that overshoots and settles, use CriticalSpringDampVector2D instead.

Signature

static FVector2D DampVector2D(const FVector2D& Value, const FVector2D& Target, float DeltaTime, float SmoothingTime = 0.2f);

Parameters

Name Type Description Default
Value const FVector2D& The 2D value to be smoothed.
Target const FVector2D& 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

FVector2D

Example

Smooth a 2D input value frame-to-frame C++
FVector2D SmoothedInput = FVector2D::ZeroVector;

void AMyPawn::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    SmoothedInput = UBlueprintSpringMathLibrary::DampVector2D(SmoothedInput, RawInput, DeltaTime, 0.15f);
}

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.