From 027e83036023bee3d182c2bd3266a3b09e11b06e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 22 Feb 2012 00:45:18 -0500 Subject: [PATCH 1/2] Keep dynamics asleep during init process When we set the global pose and transform, we wake up dynamics. This can be somewhat evil, so we put them back to sleep as they are supposed to be. --- Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index adf614e2..d81f9387 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1220,8 +1220,9 @@ 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 @@ -1243,6 +1244,11 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV 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. + if (isLoading && GetProperty(plSimulationInterface::kStartInactive) && !fActor->readBodyFlag(NX_BF_KINEMATIC)) + fActor->putToSleep(); + SendNewLocation(false, true); } From efd03fc33ec727d02da77e917d067ebe3c15d021 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 22 Feb 2012 01:24:12 -0500 Subject: [PATCH 2/2] Pop cameras when we exit a region Fixes issues with cameras that have been added to the stack in python using that weird spawn point hack. --- Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp index 57a3648d..c0b03ffd 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp @@ -276,12 +276,14 @@ void plCameraRegionDetector::ISendSavedTriggerMsgs() if (fSavedMsgEnterFlag) { fMessages[i]->SetCmd(plCameraMsg::kEntering); + fMessages[i]->ClearCmd(plCameraMsg::kPop); DetectorLog("Entering cameraRegion: %s - Evals=%d -msg %d of %d\n", GetKeyName().c_str(),fNumEvals,i+1,fMessages.size()); fIsInside = true; } else { fMessages[i]->ClearCmd(plCameraMsg::kEntering); + fMessages[i]->SetCmd(plCameraMsg::kPop); // for spawnpoints with a camera stack DetectorLog("Exiting cameraRegion: %s - Evals=%d -msg %d of %d\n", GetKeyName().c_str(),fNumEvals,i+1,fMessages.size()); fIsInside = false; }