RealDocs

UKismetMathLibrary::ResetFloatSpringState

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Resets a float spring's velocity and previous-target tracking back to zero/invalid, as if it had never run. Call this before reusing a spring for an unrelated value or after a large discontinuity (e.g. a teleport) to avoid a visible snap.

Caveats & Gotchas

  • Only clears the spring's internal state — it does not change the Current value you pass into FloatSpringInterp on the next call, so you may also want to explicitly reset Current at the same time.
  • Forgetting to reset after reassigning a spring variable to a new logical target causes the old velocity to bleed into the new interpolation, producing an unexpected overshoot on the first few frames.

Signature

static void ResetFloatSpringState(UPARAM(ref) FFloatSpringState& SpringState)

Parameters

Name Type Description Default
SpringState FFloatSpringState& The spring state to reset.

Return Type

void

Example

Reset spring state after a teleport C++
void AMyCamera::OnTeleport()
{
    UKismetMathLibrary::ResetFloatSpringState(FOVSpringState);
    CurrentFOV = TargetFOV;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.