APawn::PostNetReceiveVelocity
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtualoverride
Description
Called on simulated proxies after velocity is received from the server during network updates. Forwards the new velocity to the movement component so it can update its internal state.
Caveats & Gotchas
- • This is an engine-internal replication callback called only on simulated proxy clients, never on the server or the owning client — do not call it directly in game code.
- • If your custom movement component stores velocity separately from UMovementComponent::Velocity, you must override this function to update your component's velocity field, otherwise GetVelocity() will return stale data on proxies.
Signature
ENGINE_API virtual void PostNetReceiveVelocity(const FVector& NewVelocity) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewVelocity | const FVector& | The replicated velocity received from the server. | — |
Return Type
void Example
Override to update a custom movement component's velocity C++
void AMyPawn::PostNetReceiveVelocity(const FVector& NewVelocity)
{
if (UMyMovementComponent* MoveComp = GetMyMovementComponent())
{
MoveComp->Velocity = NewVelocity;
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?