Navigation
API > API/Plugins > API/Plugins/AnimationLocomotionLibraryRuntim- > API/Plugins/AnimationLocomotionLibraryRuntim-/UAnimDistanceMatchingLibrary
Description
Set the play rate of the sequence player so that the speed of the animation matches in-game movement speed. While distance matching is commonly used for transition animations, cycle animations (walk, jog, etc) typically just adjust their play rate to match the in-game movement speed. This function assumes that the animation has a constant speed.
| Name | SetPlayrateToMatchSpeed |
| Type | function |
| Header File | /Engine/Plugins/Animation/AnimationLocomotionLibrary/Source/Runtime/Public/AnimDistanceMatchingLibrary.h |
| Include Path | #include "AnimDistanceMatchingLibrary.h" |
| Source | /Engine/Plugins/Animation/AnimationLocomotionLibrary/Source/Runtime/Private/AnimDistanceMatchingLibrary.cpp |
UFUNCTION (BlueprintCallable, Category="Distance Matching", Meta=(BlueprintThreadSafe))
static FSequencePlayerReference SetPlayrateToMatchSpeed
(
const FSequencePlayerReference & SequencePlayer,
float SpeedToMatch,
FVector2D PlayRateClamp
)
Parameters
| Name | Remarks |
|---|---|
| SequencePlayer | The sequence player node to operate on. |
| SpeedToMatch | The in-game movement speed to match. This is usually the current speed of the movement component. |
| PlayRateClamp | A clamp on how much the animation's play rate can change to match the in-game movement speed. Set to (0,0) for no clamping. |