RealDocs

UBlueprintSpringMathLibrary::CriticalSpringDampQuat

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

Description

Interpolates InOutRotation towards TargetRotation using the motion of a critically damped spring on SO(3), storing the resulting angular velocity back into InOutAngularVelocity. Preferred over the Rotator overload when gimbal-lock-free interpolation matters.

Caveats & Gotchas

  • Marked UE_EXPERIMENTAL(5.7, "SpringMath is experimental") — behaviour and defaults may change in later engine versions.
  • InOutRotation and InOutAngularVelocity must both be persisted by the caller between calls; InOutAngularVelocity is a plane vector (axis-angle rate in deg/s), not a quaternion, so do not attempt to normalize or multiply it as if it were one.
  • TargetRotation and InOutRotation should be normalized quaternions — feeding in an un-normalized FQuat produces a spring that drifts towards incorrect scale over many ticks.

Signature

static void CriticalSpringDampQuat(UPARAM(ref) FQuat& InOutRotation, UPARAM(ref) FVector& InOutAngularVelocity, const FQuat& TargetRotation, float DeltaTime, float SmoothingTime = 0.2f);

Parameters

Name Type Description Default
InOutRotation FQuat& The rotation to be damped; updated in place each call.
InOutAngularVelocity FVector& The angular velocity in deg/s; must be persisted by the caller between calls.
TargetRotation const FQuat& The goal rotation to damp towards.
DeltaTime float Timestep in seconds.
SmoothingTime float Smoothing time for the spring. Larger values give more damped behaviour; 0 snaps InOutRotation to TargetRotation. 0.2f

Return Type

void

Example

Smooth an object's rotation towards a target orientation C++
FQuat SmoothedRotation = GetActorQuat();
FVector RotationalVelocity = FVector::ZeroVector;

void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    UBlueprintSpringMathLibrary::CriticalSpringDampQuat(SmoothedRotation, RotationalVelocity, TargetQuat, DeltaTime, 0.2f);
    SetActorRotation(SmoothedRotation);
}

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.