RealDocs

UKismetMathLibrary::VLerp

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

Description

Linearly interpolates between two vectors based on Alpha. Returns A when Alpha is 0 and B when Alpha is 1.

Caveats & Gotchas

  • Alpha is not clamped — passing values outside [0,1] will extrapolate beyond A and B. Wrap in FMath::Clamp(Alpha, 0.f, 1.f) if your source is unbounded.
  • VLerp interpolates magnitude as well as direction. If A and B have different lengths the result will not maintain either length. Use spherical linear interpolation (Slerp) if constant arc length across unit vectors is required.

Signature

static UE_INL_API FVector VLerp(FVector A, FVector B, float Alpha);

Parameters

Name Type Description Default
A FVector Start vector (returned when Alpha=0).
B FVector End vector (returned when Alpha=1).
Alpha float Interpolation factor in [0,1]. Values outside this range extrapolate.

Return Type

FVector

Example

Smoothly position an object along a segment C++
float Alpha = FMath::Clamp(ElapsedTime / TotalDuration, 0.f, 1.f);
FVector NewPos = UKismetMathLibrary::VLerp(StartLocation, EndLocation, Alpha);
SetActorLocation(NewPos);

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.