UBlueprintSpringMathLibrary::ConvertHalfLifeToSmoothingTime
#include "Kismet/BlueprintSpringMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Converts a spring's half life (time to close half the remaining distance to the target) into an equivalent smoothing time in seconds. Half life is often a more intuitive parameter to design with than smoothing time, since it maps directly to a visible fraction of progress.
Caveats & Gotchas
- • Not itself marked UE_EXPERIMENTAL, but it lives on an Experimental UCLASS (UBlueprintSpringMathLibrary) and only makes sense alongside the other spring/damping functions, which are experimental.
- • Half life and smoothing time are not equal — a half life of 0.2s does not translate to a SmoothingTime of 0.2f; always convert through this function rather than assuming the two values are interchangeable.
Signature
static float ConvertHalfLifeToSmoothingTime(float HalfLife); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| HalfLife | float | The half life of the spring — how long it takes the value to get halfway toward the target. | — |
Return Type
float Example
Design a damp using half life instead of smoothing time C++
// Value should close half the remaining gap to target every 0.1 seconds
float SmoothingTime = UBlueprintSpringMathLibrary::ConvertHalfLifeToSmoothingTime(0.1f);
SmoothedValue = UBlueprintSpringMathLibrary::DampFloat(SmoothedValue, TargetValue, DeltaTime, SmoothingTime); Tags
Version History
Introduced in: 5.7
| Version | Status | Notes |
|---|---|---|
| 5.7 | experimental | SpringMath is experimental. |
Feedback
Was this helpful?