UKismetMathLibrary::TInterpTo
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Smoothly interpolates a transform from Current toward Target at a rate proportional to the remaining distance, giving an exponential ease-out feel each tick. Commonly used to smoothly track a moving target transform frame to frame.
Caveats & Gotchas
- • Must be called every tick with that tick's DeltaTime — calling it once will not converge on Target, since the interpolation is frame-rate dependent by design.
- • An InterpSpeed of 0 snaps directly to Target instead of interpolating, which surprises people expecting 0 to mean "no movement".
- • Never exactly reaches Target because the step size shrinks each tick; if you need an exact stop, add a distance/angle threshold check and snap when close enough.
Signature
static FTransform TInterpTo(const FTransform& Current, const FTransform& Target, float DeltaTime, float InterpSpeed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Current | const FTransform& | The actual transform this tick. | — |
| Target | const FTransform& | The transform 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
FTransform Example
Smoothly track a target transform each tick C++
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FTransform Smoothed = UKismetMathLibrary::TInterpTo(GetActorTransform(), TargetTransform, DeltaTime, 5.0f);
SetActorTransform(Smoothed);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?