RealDocs

UBlueprintSpringMathLibrary::DampRotator

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

Description

Smooths Rotation towards TargetRotation using exponential damping, returning the new smoothed rotator each call. Convenient when working directly with Blueprint Rotator values, but internally converts to quaternions to avoid Euler interpolation issues.

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 Rotation on the next call — this function does not persist any state internally.
  • If you already have quaternions on hand (e.g. from a bone transform), use DampQuat directly to avoid the extra rotator/quaternion conversions this function performs internally.

Signature

static FRotator DampRotator(const FRotator& Rotation, const FRotator& TargetRotation, float DeltaTime, float SmoothingTime = 0.2f);

Parameters

Name Type Description Default
Rotation const FRotator& The rotation to be smoothed.
TargetRotation const FRotator& The target rotation 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

FRotator

Example

Smooth a rotator frame-to-frame C++
FRotator SmoothedRot = FRotator::ZeroRotator;

void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    SmoothedRot = UBlueprintSpringMathLibrary::DampRotator(SmoothedRot, TargetRotation, DeltaTime, 0.2f);
    SetActorRotation(SmoothedRot);
}

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.