UKismetMathLibrary::RInterpTo
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Smoothly rotates from Current toward Target rotation at a rate proportional to the remaining angular distance, giving an exponential ease-out feel. Commonly used each tick to turn an actor toward a facing direction.
Caveats & Gotchas
- • Must be called every tick with that tick's DeltaTime; a single call will not reach Target since the turn rate scales with remaining distance.
- • Interpolates per-axis on the rotator (pitch, yaw, roll independently), which can produce visibly different motion than a quaternion slerp for large rotations — use RInterpTo_Constant or a quaternion-based approach if you need uniform angular velocity.
- • An InterpSpeed of 0 snaps directly to Target instead of leaving Current unchanged.
Signature
static FRotator RInterpTo(FRotator Current, FRotator Target, float DeltaTime, float InterpSpeed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Current | FRotator | The actual rotation this tick. | — |
| Target | FRotator | The rotation being tracked. | — |
| DeltaTime | float | Time since the last update, typically the frame's delta time. | — |
| InterpSpeed | float | Interpolation speed; a value of 0 jumps straight to Target. | — |
Return Type
FRotator Example
Smoothly turn an actor to face a target rotation C++
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FRotator NewRotation = UKismetMathLibrary::RInterpTo(GetActorRotation(), TargetRotation, DeltaTime, 5.0f);
SetActorRotation(NewRotation);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?