RealDocs

APawn::PostNetReceiveLocationAndRotation

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverride

Description

Called on clients after the replicated location and rotation are applied to the actor. APawn overrides this to skip the update for locally controlled pawns, preventing the server's position from snapping over the client's predicted position.

Caveats & Gotchas

  • Do not call this on locally controlled pawns manually — the APawn override intentionally skips the update for locally controlled pawns to preserve client-side prediction. Calling it directly will cause a snap back to the server's stale position.
  • This is part of the basic movement replication path used by non-CharacterMovementComponent pawns. Characters (which use CMC) have their own correction path (SmoothClientPosition) and rarely hit this code.
  • If you override PostNetReceiveLocationAndRotation in a subclass, check IsLocallyControlled() before applying position changes — the base APawn check is easy to accidentally bypass.

Signature

virtual void PostNetReceiveLocationAndRotation() override

Return Type

void

Example

Apply a visual smoothing offset on net receive C++
void AMySimplePawn::PostNetReceiveLocationAndRotation()
{
	if (IsLocallyControlled())
	{
		// Don't overwrite predicted position
		return;
	}
	// Let base class apply the replicated transform
	Super::PostNetReceiveLocationAndRotation();
	// Trigger visual interpolation to smooth the snap
	StartPositionSmoothing();
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.