UKismetMathLibrary::FInterpTo
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Smoothly interpolates a float value from Current toward Target at a rate proportional to the remaining distance, producing an exponential ease-out feel each tick. This is the scalar counterpart of VInterpTo and RInterpTo.
Caveats & Gotchas
- • Must be called every frame with that frame's DeltaTime; calling it once does not converge on Target because the step size depends on elapsed time.
- • An InterpSpeed of 0 snaps immediately to Target rather than leaving the value unchanged, which trips people up when they intend 0 to mean "disabled".
- • Never lands exactly on Target — add an explicit distance check (e.g. FMath::IsNearlyEqual) if you need to know when interpolation has effectively finished.
Signature
static double FInterpTo(double Current, double Target, double DeltaTime, double InterpSpeed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Current | double | The actual value this tick. | — |
| Target | double | The value being tracked. | — |
| DeltaTime | double | Time since the last update, typically the frame's delta time. | — |
| InterpSpeed | double | Interpolation speed; a value of 0 jumps straight to Target. | — |
Return Type
double Example
Smoothly track a target zoom value each tick C++
void AMyCamera::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
CurrentFOV = UKismetMathLibrary::FInterpTo(CurrentFOV, TargetFOV, DeltaTime, 8.0);
CameraComponent->SetFieldOfView(CurrentFOV);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?