RealDocs

UCharacterMovementComponent::ConvertRootMotionServerIDsToLocalIDs

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

Description

Rewrites server-assigned root motion source IDs in InOutServerRootMotion to the equivalent local client IDs, using the most recent ID mappings recorded during move replay.

Caveats & Gotchas

  • • Relies on RootMotionIDMappings, a fixed-size ring buffer (ERootMotionMapping::MapSize = 16 entries) — if too many root motion sources are applied between corrections, older mappings are evicted and matching can fail.
  • • Client and server root motion source IDs are assigned independently, so without this conversion a client correction referencing a server ID would not match any local root motion source.
  • • Called only during client-side reconciliation of server root motion corrections; irrelevant on a dedicated server.

Signature

void ConvertRootMotionServerIDsToLocalIDs(const FRootMotionSourceGroup& LocalRootMotionToMatchWith, FRootMotionSourceGroup& InOutServerRootMotion, float TimeStamp)

Parameters

Name Type Description Default
LocalRootMotionToMatchWith const FRootMotionSourceGroup& The client's local root motion group, used as the basis for matching server sources to local IDs. —
InOutServerRootMotion FRootMotionSourceGroup& The server-received root motion group whose IDs are rewritten in place to match local IDs. —
TimeStamp float The move timestamp the correction applies to, used to look up the relevant ID mapping. —

Return Type

void

Example

Reconcile server root motion IDs before applying a correction C++
FRootMotionSourceGroup ServerRootMotion = ReceivedServerRootMotion;
CharacterMovementComponent->ConvertRootMotionServerIDsToLocalIDs(CharacterMovementComponent->CurrentRootMotion, ServerRootMotion, TimeStamp);
// ServerRootMotion now uses local IDs matching CurrentRootMotion

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable —

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.