Maybe we can solve it by looking at finterp and finterpConstant’s code, here they are :
CORE_API float FMath::FInterpTo( float Current, float Target, float DeltaTime, float InterpSpeed )
{
// If no interp speed, jump to target value
if( InterpSpeed <= 0.f )
{
return Target;
}
// Distance to reach
const float Dist = Target - Current;
// If distance is too small, just set the desired location
if( FMath::Square(Dist) < SMALL_NUMBER )
{
return Target;
}
// Delta Move, Clamp so we do not over shoot.
const float DeltaMove = Dist * FMath::Clamp<float>(DeltaTime * InterpSpeed, 0.f, 1.f);
return Current + DeltaMove;
}
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;
return Current + FMath::Clamp<float>(Dist, -Step, Step);
}
I guess now we can do it, but don’t understand why don’t you make your own function ? it would be easier to make a InterpTo over time.