RealDocs

UBlueprintSpringMathLibrary::DampVector

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 vector each call. Stateless and pure — a lightweight alternative to CriticalSpringDampVector when overshoot is not desired.

Caveats & Gotchas

  • Marked UE_EXPERIMENTAL(5.7, "SpringMath is experimental") — behaviour and defaults may change in later engine versions.
  • Being pure and stateless, the caller must feed the previous frame's return value back in as Value each call; there is no persisted velocity like the spring-damp functions.
  • Produces no overshoot or bounce — if you want spring-like motion that briefly overshoots the target, use CriticalSpringDampVector instead.

Signature

static FVector DampVector(const FVector& Value, const FVector& Target, float DeltaTime, float SmoothingTime = 0.2f);

Parameters

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

FVector

Example

Smooth a position frame-to-frame without overshoot C++
FVector SmoothedLocation = GetActorLocation();

void AMyFollowCam::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    SmoothedLocation = UBlueprintSpringMathLibrary::DampVector(SmoothedLocation, TargetActor->GetActorLocation(), DeltaTime, 0.25f);
    SetActorLocation(SmoothedLocation);
}

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.