Download

Framerate independence on interpolation?

I noticed while peeking interpolation functions in their definitions I noticed that the common strategy of achieving framerate independence is already implemented (which is to multiply DeltaTime*Speed). I’ve added a snippet of what I’m talking about…

CORE_API float FMath::FInterpConstantTo( float Current, float Target, float DeltaTime, float InterpSpeed )
{
	const float Dist = Target - Current;

	// If distance is too small, just set the desired location
	if( FMath::Square(Dist) < SMALL_NUMBER )
	{
		return Target;
	}

	const float Step = InterpSpeed * DeltaTime; <------------Framerate Independence?
	return Current + FMath::Clamp<float>(Dist, -Step, Step);
}

My question is mostly to confirm if my inference is correct, in that is it correct to assume that these interpolation functions already implement framerate independence?

You are passing in delta time so yes.

There are other interp functions where you have to account for delta. For example the ones where you pass in alpha.

FMath::InterpEaseInOut()

FMath::InterpEaseIn | Unreal Engine Documentation