ACharacter::OnUpdateSimulatedPosition
#include "GameFramework/Character.h"
Access: public
Specifiers: virtual
Description
Called on the client after a network position update is received and `CharacterMovement->SmoothCorrection()` has run. Override to handle large teleport-style corrections or update dependent state after the simulated proxy snaps to its new position.
Caveats & Gotchas
- • This runs only on clients, specifically for simulated proxies, not for the locally controlled character. Never put game logic here that should run on the server or the owning client.
- • By default, if `bClientCheckEncroachmentOnNetUpdate` is true, the engine checks for capsule penetration and may set `bSimGravityDisabled=true`. Overriding without calling `Super::` disables this safety check, which can cause simulated proxies to fall through floors.
- • The position has already changed when this fires — `OldLocation` is the pre-correction location. If you need to detect large corrections (teleports vs. smooth corrections), compare the delta between `OldLocation` and `GetActorLocation()` here.
Signature
ENGINE_API virtual void OnUpdateSimulatedPosition(const FVector& OldLocation, const FQuat& OldRotation) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OldLocation | const FVector& | The character's world location before the network position correction was applied. | — |
| OldRotation | const FQuat& | The character's world rotation before the network position correction was applied. | — |
Return Type
void Example
Detect large position corrections on simulated proxies C++
void AMyCharacter::OnUpdateSimulatedPosition(const FVector& OldLocation, const FQuat& OldRotation)
{
Super::OnUpdateSimulatedPosition(OldLocation, OldRotation);
const float TeleportThresholdSq = 500.f * 500.f;
if (FVector::DistSquared(OldLocation, GetActorLocation()) > TeleportThresholdSq)
{
// Large correction — skip interpolation and snap effects
OnTeleported();
}
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?