UKismetMathLibrary::FInterpTo_Constant
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Moves a float value from Current toward Target at a constant rate (InterpSpeed units per second), unlike FInterpTo which slows as it approaches the target. Produces a linear ramp that reaches Target exactly and then stops.
Caveats & Gotchas
- • Unlike FInterpTo, this does reach Target exactly and clamps there — it won't overshoot even with a large DeltaTime.
- • InterpSpeed here is a rate (units/second), not a smoothing factor, so the same numeric value behaves very differently between FInterpTo and FInterpTo_Constant — don't swap one call for the other without adjusting the speed parameter.
Signature
static double FInterpTo_Constant(double Current, double Target, double DeltaTime, double InterpSpeed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Current | double | The actual value this tick. | — |
| Target | double | The value being tracked. | — |
| DeltaTime | double | Time since the last update, typically the frame's delta time. | — |
| InterpSpeed | double | Constant rate of change per second. | — |
Return Type
double Example
Drain a stamina value at a fixed rate C++
void AMyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
Stamina = UKismetMathLibrary::FInterpTo_Constant(Stamina, 0.0, DeltaTime, 10.0);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?