RealDocs

UBlueprintSpringMathLibrary::DampAngle

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

Description

Smooths Angle towards TargetAngle using exponential damping, returning the new smoothed angle in degrees each call. Stateless and pure — no velocity is tracked.

Caveats & Gotchas

  • Marked UE_EXPERIMENTAL(5.7, "SpringMath is experimental") — behaviour and defaults may change in later engine versions.
  • Does not perform shortest-path wraparound across the 0/360 boundary, so an Angle of 359 damping towards a TargetAngle of 1 will smooth the long way around unless you normalize the angle delta yourself first.
  • Being pure and stateless, the caller must feed the previous return value back in as Angle each call to get continuous smoothing.

Signature

static float DampAngle(float Angle, float TargetAngle, float DeltaTime, float SmoothingTime = 0.2f);

Parameters

Name Type Description Default
Angle float The angle to be smoothed, in degrees.
TargetAngle float The target angle to smooth towards, in degrees.
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 an angle value frame-to-frame C++
float SmoothedAngle = 0.f;

void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    SmoothedAngle = UBlueprintSpringMathLibrary::DampAngle(SmoothedAngle, TargetAngle, 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.