UCharacterMovementComponent::SmoothCorrection
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualoverride
Description
Reacts to a new transform received from a network update on the client, applying it and clearing bNetworkSmoothingComplete so future smoothing updates blend from the corrected state.
Caveats & Gotchas
- • Only runs on the client for simulated proxies / autonomous proxy corrections — it's part of the client-side prediction correction path, not something the server calls.
- • It is expected to actually apply the movement/transform update itself; simply overriding it and not moving the component (or not calling Super) will desync visuals from the corrected server state.
- • Sets bNetworkSmoothingComplete to false, which re-arms mesh smoothing interpolation over subsequent ticks — if you skip that, mesh location can visually snap instead of smoothly correcting.
Signature
virtual void SmoothCorrection(const FVector& OldLocation, const FQuat& OldRotation, const FVector& NewLocation, const FQuat& NewRotation) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OldLocation | const FVector& | Client-predicted location before the network correction. | — |
| OldRotation | const FQuat& | Client-predicted rotation before the network correction. | — |
| NewLocation | const FVector& | Authoritative location received from the server. | — |
| NewRotation | const FQuat& | Authoritative rotation received from the server. | — |
Return Type
void Example
Logging network corrections in a custom subclass C++
void UMyCharacterMovementComponent::SmoothCorrection(const FVector& OldLocation, const FQuat& OldRotation, const FVector& NewLocation, const FQuat& NewRotation)
{
const float CorrectionDistance = FVector::Dist(OldLocation, NewLocation);
UE_LOG(LogTemp, Verbose, TEXT("Network correction distance: %f"), CorrectionDistance);
Super::SmoothCorrection(OldLocation, OldRotation, NewLocation, NewRotation);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?