RealDocs

UKismetMathLibrary::VInterpTo

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Smoothly moves a vector toward a target each frame using an exponential decay approach. Produces a natural ease-out feel without overshooting. Commonly used for camera lag, smooth following, or any value that should catch up to a moving target.

Caveats & Gotchas

  • The underlying formula is frame-rate dependent by design — the feel changes at different frame rates. If consistent behavior across frame rates is critical, use FMath::VInterpConstantTo or accumulate with a fixed timestep. In practice the visual difference is subtle for typical game frame rates.
  • Passing InterpSpeed = 0 causes an immediate snap to Target (the function special-cases it). This is useful for initializing the value on the first frame, but be careful not to accidentally pass 0 during normal gameplay if you expect gradual movement.

Signature

static UE_INL_API FVector VInterpTo(FVector Current, FVector Target, float DeltaTime, float InterpSpeed);

Parameters

Name Type Description Default
Current FVector The current value to interpolate from.
Target FVector The target value to interpolate toward.
DeltaTime float Time elapsed since the last call, in seconds.
InterpSpeed float Interpolation speed. Higher values converge faster. Pass 0 to snap immediately to Target.

Return Type

FVector

Example

Smooth camera lag in Tick C++
void AMyPlayerController::PlayerTick(float DeltaTime)
{
    Super::PlayerTick(DeltaTime);
    FVector TargetCamPos = GetPawn()->GetActorLocation() + FVector(0, 0, 200);
    CameraLocation = UKismetMathLibrary::VInterpTo(CameraLocation, TargetCamPos, DeltaTime, 5.f);
    Camera->SetWorldLocation(CameraLocation);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.