Navigation
API > API/Runtime > API/Runtime/AnimGraphRuntime > API/Runtime/AnimGraphRuntime/UKismetAnimationLibrary
Description
This function calculates the velocity of a position changing over time. You need to hook up a valid PositionHistory variable to this for storage.
| Name | K2_CalculateVelocityFromPositionHistory |
| Type | function |
| Header File | /Engine/Source/Runtime/AnimGraphRuntime/Public/KismetAnimationLibrary.h |
| Include Path | #include "KismetAnimationLibrary.h" |
| Source | /Engine/Source/Runtime/AnimGraphRuntime/Private/KismetAnimationLibrary.cpp |
UFUNCTION (BlueprintCallable, Category="Animation|Utilities",
Meta=(DisplayName="Calculate Velocity From Position History", ScriptName="CalculateVelocityFromPositionHistory", NumberOfSamples="16", VelocityMin="0.f", VelocityMax="128.f"))
static float K2_CalculateVelocityFromPositionHistory
(
float DeltaSeconds,
FVector Position,
UPARAM FPositionHistory & History,
int32 NumberOfSamples,
float VelocityMin,
float VelocityMax
)
Parameters
| Name | Remarks |
|---|---|
| DeltaSeconds | The time passed in seconds |
| Position | The position to track over time. |
| History | The history to use for storage. |
| NumberOfSamples | The number of samples to use for the history. The higher the number of samples - the smoother the velocity changes. |
| VelocityMin | The minimum velocity to use for normalization (if both min and max are set to 0, normalization is turned off) |
| VelocityMax | The maximum velocity to use for normalization (if both min and max are set to 0, normalization is turned off) |