UCharacterMovementComponent::ClientAdjustRootMotionSourcePosition_Implementation
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualENGINE_API
Description
Applies a position correction from the server while one or more RootMotionSources (e.g. from RootMotionSource_ApplyForce) are driving the client's movement, resyncing the client's root motion source group to the server's.
Caveats & Gotchas
- • This is the most expensive correction path of the three ClientAdjust*_Implementation variants because it also has to reconcile the full FRootMotionSourceGroup state, not just location/velocity.
- • Requires the root motion source IDs on client and server to already be mapped consistently, or the resync can apply the wrong source's parameters — see ConvertRootMotionServerIDsToLocalIDs.
- • Only reached when there's at least one active root motion source; plain anim root motion without sources uses ClientAdjustRootMotionPosition_Implementation instead.
Signature
virtual void ClientAdjustRootMotionSourcePosition_Implementation(float TimeStamp, FRootMotionSourceGroup ServerRootMotion, bool bHasAnimRootMotion, float ServerMontageTrackPosition, FVector ServerLoc, FVector_NetQuantizeNormal ServerRotation, float ServerVelZ, UPrimitiveComponent* ServerBase, FName ServerBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TimeStamp | float | Client move timestamp this correction responds to. | — |
| ServerRootMotion | FRootMotionSourceGroup | Authoritative snapshot of the server's active root motion sources (e.g. force/velocity sources). | — |
| bHasAnimRootMotion | bool | Whether anim root motion was also active on the server for this move. | — |
| ServerMontageTrackPosition | float | Server's authoritative playback position in the active root motion montage, if bHasAnimRootMotion is true. | — |
| ServerLoc | FVector | Corrected world location from the server. | — |
| ServerRotation | FVector_NetQuantizeNormal | Corrected rotation from the server, quantized as a normal vector. | — |
| ServerVelZ | float | Corrected vertical velocity from the server. | — |
| ServerBase | UPrimitiveComponent* | Movement base the server has the character standing on, if any. | — |
| ServerBoneName | FName | Bone name on ServerBase the character is attached to, if applicable. | — |
| bHasBase | bool | Whether ServerBase is valid. | — |
| bBaseRelativePosition | bool | Whether ServerLoc is relative to ServerBase rather than world space. | — |
| ServerMovementMode | uint8 | Packed movement mode the server had at the time of correction. | — |
Return Type
void Example
Root motion source correction path C++
// Reached when the client had one or more active FRootMotionSource entries applied:
virtual void ClientAdjustRootMotionSourcePosition_Implementation(float TimeStamp,
FRootMotionSourceGroup ServerRootMotion, bool bHasAnimRootMotion, float ServerMontageTrackPosition,
FVector ServerLoc, FVector_NetQuantizeNormal ServerRotation, float ServerVelZ,
UPrimitiveComponent* ServerBase, FName ServerBoneName, bool bHasBase,
bool bBaseRelativePosition, uint8 ServerMovementMode);
// Resyncs RootMotionSourceGroup state alongside location before replaying moves. See Also
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?