RealDocs

UCharacterMovementComponent::ClientAdjustPosition_Implementation

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

Description

Applies a full position/velocity correction sent from the server to a locally controlled client, then replays subsequent unacknowledged moves from the client's saved move list.

Caveats & Gotchas

  • • This is the implementation body invoked through the ClientHandleMoveResponse RPC dispatch chain — you don't call it directly, and overriding it means reimplementing the full correction and move-replay logic yourself.
  • • Runs only on the owning client's ACharacter connection; it has no effect for simulated proxies.
  • • If bBaseRelativePosition is true, NewLoc must be interpreted relative to NewBase, not as a world-space location.

Signature

virtual void ClientAdjustPosition_Implementation(float TimeStamp, FVector NewLoc, FVector NewVel, UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode, TOptional<FRotator> OptionalRotation = TOptional<FRotator>())

Parameters

Name Type Description Default
TimeStamp float Client move timestamp this correction responds to. —
NewLoc FVector Corrected world location from the server. —
NewVel FVector Corrected velocity from the server. —
NewBase UPrimitiveComponent* Movement base the server has the character standing on, if any. —
NewBaseBoneName FName Bone name on NewBase the character is attached to, if applicable. —
bHasBase bool Whether NewBase is valid. —
bBaseRelativePosition bool Whether NewLoc is relative to NewBase rather than world space. —
ServerMovementMode uint8 Packed movement mode the server had at the time of correction. —
OptionalRotation TOptional<FRotator> Corrected rotation from the server, if the server chose to send one. TOptional<FRotator>()

Return Type

void

Example

Where this fits in the correction flow C++
// Server detects a large enough error in ServerMove_PerformMovement() and calls
// ServerSendMoveResponse(), which eventually triggers this on the owning client:
virtual void ClientAdjustPosition_Implementation(float TimeStamp, FVector NewLoc, FVector NewVel,
    UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase,
    bool bBaseRelativePosition, uint8 ServerMovementMode, TOptional<FRotator> OptionalRotation);
// Base class snaps the character to NewLoc/NewVel and replays SavedMoves after TimeStamp.

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.