UBlueprintSpringMathLibrary::CriticalSpringDampRotator
#include "Kismet/BlueprintSpringMathLibrary.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Interpolates InOutRotation towards TargetRotation using the motion of a critically damped spring, storing the resulting angular velocity back into InOutAngularVelocity. Convenience overload of CriticalSpringDampQuat for Rotator-based workflows.
Caveats & Gotchas
- • Marked UE_EXPERIMENTAL(5.7, "SpringMath is experimental") — behaviour and defaults may change in later engine versions.
- • Internally converts to and from FQuat, so it is subject to the same gimbal-related quirks as any FRotator-based interpolation near the pitch singularity; prefer CriticalSpringDampQuat directly if you are already working in quaternion space.
- • InOutRotation and InOutAngularVelocity must be persisted by the caller between calls, not re-initialized each tick.
Signature
static void CriticalSpringDampRotator(UPARAM(ref) FRotator& InOutRotation, UPARAM(ref) FVector& InOutAngularVelocity, const FRotator& TargetRotation, float DeltaTime, float SmoothingTime = 0.2f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InOutRotation | FRotator& | 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 FRotator& | 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 a Blueprint-friendly Rotator towards a target C++
FRotator SmoothedRotation = GetActorRotation();
FVector RotationalVelocity = FVector::ZeroVector;
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
UBlueprintSpringMathLibrary::CriticalSpringDampRotator(SmoothedRotation, RotationalVelocity, TargetRotator, DeltaTime, 0.2f);
SetActorRotation(SmoothedRotation);
} Tags
Version History
Introduced in: 5.7
| Version | Status | Notes |
|---|---|---|
| 5.7 | experimental | SpringMath is experimental. |
Feedback
Was this helpful?