UKismetMathLibrary::SetVectorSpringStateVelocity
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Overwrites the internal velocity stored in a vector spring state, without touching the position it is currently tracking. Use it to inject an instantaneous impulse, such as recoil or a bump, into an ongoing VectorSpringInterp.
Caveats & Gotchas
- • Does not change the Current value passed into VectorSpringInterp — it only changes the momentum used on the spring's next update, so the visible position keeps moving smoothly from wherever it already is.
- • Calling this every frame defeats the purpose of a spring; it is meant for one-off nudges, not for driving continuous motion — use VectorSpringInterp's own parameters for that.
Signature
static void SetVectorSpringStateVelocity(UPARAM(ref) FVectorSpringState& SpringState, FVector Velocity) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SpringState | FVectorSpringState& | The spring state whose internal velocity is overwritten. | — |
| Velocity | FVector | The new velocity to assign to the spring's internal momentum. | — |
Return Type
void Example
Add recoil impulse to a camera spring C++
void AMyWeapon::ApplyRecoil()
{
UKismetMathLibrary::SetVectorSpringStateVelocity(CameraSpringState, FVector(0.f, 0.f, 400.f));
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?