I can guess thats this all breaks inside PhysicsReplication.cpp ( atleast for physics simulated actor?) because when i am trying it on dedicated server with single client ( while FRepMovement ReplicatedMovement is synced properly) it never reaches this line with " OwningActor->Role == ROLE_SimulatedProxy "
, and IT IS when i am in 2 player mode (Simulating_Proxy is present ). As a result function ApplyRigidBodyState
never gets called on the Owner.
void FPhysicsReplication::OnTick(float DeltaSeconds, TMap<TWeakObjectPtr<UPrimitiveComponent>, FReplicatedPhysicsTarget>& ComponentsToTargets)
{
// Some Code
AActor* OwningActor = PrimComp->GetOwner();
if (OwningActor && OwningActor->Role == ROLE_SimulatedProxy) //TODO: can we avoid the replication all together?
{
// Get the ping of the guy who owns this thing. If nobody is,
// then it's server authoritative.
const float OwnerPing = GetOwnerPing(OwningActor, PhysicsTarget);
// Get the total ping - this approximates the time since the update was
// actually generated on the machine that is doing the authoritative sim.
// NOTE: We divide by 2 to approximate 1-way ping from 2-way ping.
const float PingSecondsOneWay = (LocalPing + OwnerPing) * 0.5f * 0.001f;
// force update if simulation is sleeping on server
//if ((UpdatedState.Flags & ERigidBodyFlags::Sleeping) && BI->IsInstanceAwake())
//{
// UpdatedState.Flags |= ERigidBodyFlags::NeedsUpdate;
//}
if (UpdatedState.Flags & ERigidBodyFlags::NeedsUpdate)
{
const bool bRestoredState = ApplyRigidBodyState(DeltaSeconds, BI, PhysicsTarget, PhysicErrorCorrection, PingSecondsOneWay);
//Some Code