AActor::PostNetReceivePhysicState
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called on simulated proxies when physics state (location, rotation, velocity, and angular velocity) is received from ReplicatedMovement. Supersedes PostNetReceiveLocationAndRotation and PostNetReceiveVelocity for physics-simulated actors.
Caveats & Gotchas
- • Only called when bRepPhysics is true on the actor's ReplicatedMovement struct. If you enable physics replication, ensure this function correctly applies state to avoid visual pops.
- • The default implementation calls SyncReplicatedPhysicsSimulation, which tries to apply state smoothly. Overriding without calling Super bypasses this smoothing entirely.
- • Physics state replication introduces a full frame of latency — the client simulates locally and receives corrections asynchronously. Override this to implement custom correction blending if the default correction is too jarring.
Signature
ENGINE_API virtual void PostNetReceivePhysicState(); Return Type
void Example
Logging physics state corrections C++
void AMyPhysicsActor::PostNetReceivePhysicState()
{
const FVector PreCorrection = GetActorLocation();
Super::PostNetReceivePhysicState();
const FVector PostCorrection = GetActorLocation();
const float ErrorDist = FVector::Dist(PreCorrection, PostCorrection);
if (ErrorDist > 10.0f)
{
UE_LOG(LogGame, Warning, TEXT("Physics correction: %.1f cm"), ErrorDist);
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?