RealDocs

ACharacter::FindRootMotionRepMove

function Engine Since 4.14
#include "GameFramework/Character.h"
Access: public Specifiers: ENGINE_API

Description

Searches RootMotionRepMoves backwards in time to find the most recent buffered server move that passes CanUseRootMotionRepMove(). Returns the index of that move, or INDEX_NONE if none is usable.

Caveats & Gotchas

  • Returns INDEX_NONE when no usable move is found — callers must always check for this before indexing into RootMotionRepMoves. An unchecked index will cause an out-of-bounds access.
  • The search goes backwards (newest to oldest) and stops at the first usable move. If the montage position has diverged significantly from the buffered moves, no match may be found and root motion correction is skipped.

Signature

ENGINE_API int32 FindRootMotionRepMove(const FAnimMontageInstance& ClientMontageInstance) const;

Parameters

Name Type Description Default
ClientMontageInstance const FAnimMontageInstance& The currently playing montage instance on the client, used to match against buffered moves.

Return Type

int32

Example

Use FindRootMotionRepMove to apply a correction C++
const int32 MoveIndex = Character->FindRootMotionRepMove(*MontageInstance);
if (MoveIndex != INDEX_NONE)
{
	Character->RestoreReplicatedMove(Character->RootMotionRepMoves[MoveIndex]);
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.