From b81eb21145a5750ffa81b82c8346cb447744fc37 Mon Sep 17 00:00:00 2001 From: Edmond Mondor Date: Wed, 11 May 2022 14:16:44 -0700 Subject: [PATCH 1/4] Fix compile error Author: Adam Johnson --- Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 17669f5d..6e9df8ef 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1336,7 +1336,7 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV // we've got right now) if (pos && pos->fZ < kMaxNegativeZPos && initialSync) { - SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName().c_str()); + SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName()); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); return; } From 54c768d966fa91e7cd6aafec75342720c392a0d8 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 4 May 2022 20:16:58 -0700 Subject: [PATCH 2/4] PR from Huru to prevent dynamics from moving during age initilization --- .../Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 03996b27..17669f5d 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1328,15 +1328,15 @@ void plPXPhysical::GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsV void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) { - bool initialSync = plNetClientApp::GetInstance()->IsLoadingInitialAgeState() && - plNetClientApp::GetInstance()->GetJoinOrder() == 0; - + bool isLoading = plNetClientApp::GetInstance()->IsLoadingInitialAgeState(); + bool isFirstIn = plNetClientApp::GetInstance()->GetJoinOrder() == 0; + bool initialSync = isLoading && isFirstIn; // If the physical has fallen out of the sim, and this is initial age state, and we're // the first person in, reset it to the original position. (ie, prop the default state // we've got right now) if (pos && pos->fZ < kMaxNegativeZPos && initialSync) { - SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName()); + SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName().c_str()); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); return; } @@ -1350,6 +1350,13 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV SetLinearVelocitySim(*linV); if (angV) SetAngularVelocitySim(*angV); + // If we're loading the age, then we should ensure the objects stay asleep if they're supposed to be asleep. + // NOTE: We should only do this if the objects are not at their initial locations. Otherwise, they might + // sleep inside each other and explode or float randomly in midair + if (isLoading && GetProperty(plSimulationInterface::kStartInactive) && !fActor->readBodyFlag(NX_BF_KINEMATIC)) { + if (!pos && !rot) + fActor->putToSleep(); + } SendNewLocation(false, true); } From b322ee094c6bffac3ffb739c6cb11235b29a5e41 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 11 May 2022 14:16:44 -0700 Subject: [PATCH 3/4] Fix compile error --- Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 17669f5d..6e9df8ef 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1336,7 +1336,7 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV // we've got right now) if (pos && pos->fZ < kMaxNegativeZPos && initialSync) { - SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName().c_str()); + SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName()); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); return; }