Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/UBlueprintSpringMathLibrary
Description
Update a position representing a character given a target velocity using a velocity spring. A velocity spring tracks an intermediate velocity which moves at a maximum acceleration linearly towards a target. This means unlike the "SpringCharacterUpdate", it will take longer to reach a target velocity that is further away from the current velocity.
| Name | VelocitySpringCharacterUpdate |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/Kismet/BlueprintSpringMathLibrary.h |
| Include Path | #include "Kismet/BlueprintSpringMathLibrary.h" |
| Source | /Engine/Source/Runtime/Engine/Private/BlueprintSpringMathLibrary.cpp |
UFUNCTION (BlueprintCallable, Meta=(Category="Math|Spring|Experimental"))
static void VelocitySpringCharacterUpdate
(
FVector & InOutPosition,
FVector & InOutVelocity,
FVector & InOutVelocityIntermediate,
FVector & InOutAcceleration,
const FVector & TargetVelocity,
float DeltaTime,
float SmoothingTime,
float MaxAcceleration
)
Parameters
| Name | Remarks |
|---|---|
| InOutPosition | The position of the character |
| InOutVelocity | The velocity of the character. Needs to be stored and persisted by the caller. Usually initialized to zero and not modified by the caller. |
| InOutVelocityIntermediate | The intermediate velocity of the character. Needs to be stored and persisted by the caller. Usually initialized to zero and not modified by the caller. |
| InOutAcceleration | The acceleration of the character. Needs to be stored and persisted by the caller. Usually initialized to zero and not modified by the caller. |
| TargetVelocity | The target velocity of the character. |
| DeltaTime | The delta time to tick the character |
| SmoothingTime | The time over which to smooth velocity. It takes roughly the smoothing time in order for the character to reach the target velocity. |
| MaxAcceleration | Puts a limit on the maximum acceleration that the intermediate velocity can do each frame. If MaxAccel is very large, the behaviour wil lbe the same as SpringCharacterUpdate |