RealDocs

UCharacterMovementComponent::SimulateRootMotion

function Engine Since unknown
#include "GameFramework/CharacterMovementComponent.h"
Access: public Specifiers: ENGINE_API

Description

Applies animation root motion physics on a simulated proxy, converting the given component-space root motion delta to world space and moving the character accordingly.

Caveats & Gotchas

  • Only intended for simulated proxies (remote copies of other clients' characters) — the locally controlled character and the server drive root motion through the main movement update instead.
  • Simulated proxies don't run full physics simulation, so this is a lighter-weight path that just applies the converted transform rather than iterating through the usual movement modes.
  • Depends on RootMotionParams already being populated for the current frame; calling it without valid root motion data moves the character by whatever stale transform is present.

Signature

void SimulateRootMotion(float DeltaSeconds, const FTransform& LocalRootMotionTransform)

Parameters

Name Type Description Default
DeltaSeconds float Elapsed time to simulate.
LocalRootMotionTransform const FTransform& Root motion delta transform in component space for this tick.

Return Type

void

Example

Where it's called from C++
// Called internally from SimulatedTick() on a simulated proxy when anim root motion is active:
if (CharacterMovement->HasAnimRootMotion())
{
    const FTransform WorldSpaceRootMotion = CharacterMovement->ConvertLocalRootMotionToWorld(
        RootMotionParams.GetRootMotionTransform(), DeltaSeconds);
    CharacterMovement->SimulateRootMotion(DeltaSeconds, RootMotionParams.GetRootMotionTransform());
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.