mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
PR from Huru to prevent dynamics from moving during age initilization
This commit is contained in:
@ -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)
|
void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV)
|
||||||
{
|
{
|
||||||
bool initialSync = plNetClientApp::GetInstance()->IsLoadingInitialAgeState() &&
|
bool isLoading = plNetClientApp::GetInstance()->IsLoadingInitialAgeState();
|
||||||
plNetClientApp::GetInstance()->GetJoinOrder() == 0;
|
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
|
// 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
|
// the first person in, reset it to the original position. (ie, prop the default state
|
||||||
// we've got right now)
|
// we've got right now)
|
||||||
if (pos && pos->fZ < kMaxNegativeZPos && initialSync)
|
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);
|
DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1350,6 +1350,13 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV
|
|||||||
SetLinearVelocitySim(*linV);
|
SetLinearVelocitySim(*linV);
|
||||||
if (angV)
|
if (angV)
|
||||||
SetAngularVelocitySim(*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);
|
SendNewLocation(false, true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user