Download

Physics replication walkthrough?

Hey everyone,

Does anyone here have a good understanding of how physically simulated objects replicate from server to client? Specifically, if/where interpolation is done client-side to smooth out discrete transform updates. I’m expecting velocity to be replicated somewhere to help in this, but haven’t found the code.

Thanks!

Late reply but you might not have found the answer or other people might find this while searching. Handling replication for an actor that is simulating physics on the client side is done in OnRep_ReplicatedMovement() in /Engine/Source/Runtime/Engine/Private/ActorReplication.cpp. If you follow the chain you’ll see the actual adjustments are done in ApplyRigidBodyState() in PrimitiveComponentPhysics.cpp. If you want to see how the server replicates the Actor’s properties take a look at ServerReplicateActors() in NetworkDriver.cpp and its call to ReplicateActor() in DataChannel.cpp.