ACharacter::HasAnyRootMotion
#include "GameFramework/Character.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallableconst
Description
Returns true if root motion from any source — anim montage or FRootMotionSource — is currently active on the character. Prefer this over IsPlayingRootMotion() when a comprehensive check is needed.
Caveats & Gotchas
- • Root motion sources added via UCharacterMovementComponent::ApplyRootMotionSource will make this return true even when no montage is playing. If you care only about montage-driven root motion, use IsPlayingRootMotion() to avoid false positives.
- • On simulated proxies this reflects replicated state which may lag one net update behind the server's actual value. Do not use it for server-side authority decisions.
Signature
UFUNCTION(BlueprintCallable, Category=Animation)
ENGINE_API bool HasAnyRootMotion() const; Return Type
bool Example
Suppress custom gravity while any root motion source is active C++
void AMyCharacter::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if (HasAnyRootMotion())
{
// Root motion owns velocity — skip custom gravity
return;
}
ApplyCustomGravity(DeltaSeconds);
} Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?