RealDocs

AActor::SetFakeNetPhysicsState

function Engine Since 5.1
#include "GameFramework/Actor.h"
Access: public

Description

Forces the physics body of this actor into a fake network-replicated sleep or wake state, used exclusively with EPhysicsReplicationMode::PredictiveInterpolation. Allows the replication system to hint the solver about the expected rest state.

Caveats & Gotchas

  • The header comments explicitly state: "Limited for use with actors using EPhysicsReplicationMode::PredictiveInterpolation only." Calling this on actors using other replication modes has undefined behavior.
  • This does not immediately update ReplicatedMovement.bRepPhysics — it operates at the physics body level. Changes here do not automatically propagate to clients via replication.
  • If the physics body has constraints or joints, forcing a sleep state may not fully succeed if connected bodies are still active. Check the physics body's actual sleep state after calling this.

Signature

void SetFakeNetPhysicsState(bool bShouldSleep);

Parameters

Name Type Description Default
bShouldSleep bool If true, force the physics body to sleep; if false, wake it.

Return Type

void

Example

Hinting the physics solver to sleep during interpolation C++
// Called by the physics replication system when predicting a rest state
void AMyPhysicsActor::ForceNetworkRestHint()
{
	// Only valid when using PredictiveInterpolation mode
	SetFakeNetPhysicsState(true); // Hint: we expect this body to be sleeping
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.