RealDocs

FMath::VInterpTo

function Core Since unknown
#include "Math/UnrealMathUtility.h"
Access: public Specifiers: static

Description

Smoothly moves an FVector toward a target vector at a given speed, independently on each axis, frame-rate-independently. Vector equivalent of FInterpTo.

Signature

static CORE_API FVector VInterpTo(const FVector& Current, const FVector& Target, float DeltaTime, float InterpSpeed)

Parameters

Name Type Description Default
Current const FVector& The current vector value.
Target const FVector& The target vector to move toward.
DeltaTime float Time elapsed since last call, in seconds.
InterpSpeed float Interpolation speed. Higher values reach the target faster.

Return Type

FVector

Caveats & Gotchas

  • Interpolation is applied per-component independently — the path through 3D space will be a straight line (linear), not a curve.
  • Like FInterpTo, this uses exponential smoothing and never reaches the exact target. Add a distance threshold snap if exact arrival is required.
  • There is no equivalent RInterpTo for FRotator component-wise interpolation with clamping — use FMath::RInterpTo for rotators to avoid angle-wrap issues.

Example

Smoothly move a light's position toward a socket C++
void AMyActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	FVector TargetLocation = MeshComponent->GetSocketLocation(FName("LightSocket"));
	FVector NewLocation = FMath::VInterpTo(
		PointLight->GetComponentLocation(),
		TargetLocation,
		DeltaTime,
		8.0f
	);
	PointLight->SetWorldLocation(NewLocation);
}

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.