UBlueprintSpringMathLibrary::DampQuat
#include "Kismet/BlueprintSpringMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Smooths Rotation towards TargetRotation using exponential damping over the shortest arc, returning the new smoothed quaternion each call. Prefer this over DampRotator when interpolating rotations that must avoid gimbal-related artifacts.
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.
- • Both quaternions should be normalized before calling; feeding in an un-normalized quaternion produces undefined smoothing behaviour.
Signature
static FQuat DampQuat(const FQuat& Rotation, const FQuat& TargetRotation, float DeltaTime, float SmoothingTime = 0.2f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Rotation | const FQuat& | The rotation to be smoothed. | — |
| TargetRotation | const FQuat& | 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
FQuat Example
Smooth a rotation frame-to-frame C++
FQuat SmoothedRot = FQuat::Identity;
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
SmoothedRot = UBlueprintSpringMathLibrary::DampQuat(SmoothedRot, TargetRotation.Quaternion(), DeltaTime, 0.2f);
SetActorRotation(SmoothedRot);
} Tags
Version History
Introduced in: 5.7
| Version | Status | Notes |
|---|---|---|
| 5.7 | experimental | SpringMath is experimental. |
Feedback
Was this helpful?