RealDocs

ACharacter::GetRootMotionAnimMontageInstance

function Engine Since 4.6
#include "GameFramework/Character.h"
Access: public Specifiers: const

Description

Returns the FAnimMontageInstance currently driving root motion on this character's animation instance, or nullptr if no root-motion montage is active.

Caveats & Gotchas

  • Returns nullptr when IsPlayingNetworkedRootMotionMontage() is false — always null-check before accessing the instance fields.
  • The returned pointer is owned by the UAnimInstance and can become invalid if the montage stops or the mesh is reassigned; do not cache the pointer across frames.
  • Only montages with RootMotionMode == ERootMotionMode::RootMotionFromMontagesOnly are returned here. Montages using other root motion modes will not appear.

Signature

ENGINE_API FAnimMontageInstance * GetRootMotionAnimMontageInstance() const

Return Type

FAnimMontageInstance*

Example

Read current montage playback position from the root motion instance C++
FAnimMontageInstance* RMInstance = GetRootMotionAnimMontageInstance();
if (RMInstance)
{
    float Position = RMInstance->GetPosition();
    UE_LOG(LogTemp, Log, TEXT("Root motion montage position: %f"), Position);
}

Version History

Introduced in: 4.6

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.