From bc76f4d760bd7f72288a59ab8b84fea47807612c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 15 May 2014 19:00:28 -0400 Subject: [PATCH] Fix floating/exploding dynamic physicals Only put dynamics to sleep if they're at the initial location. This prevents baskets from exploding on touch by an avatar and should theoretically make the doggone slave cave kickables activate the pressure plates. --- Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 7576be53..a4362c31 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1059,10 +1059,13 @@ 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(); + // 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); }