Rehook dPhysics to main framerate

Should fix bug causing double enter and exit events
This commit is contained in:
Unknown
2022-02-09 10:38:09 +01:00
parent cabd220a66
commit d5a18af0e8
3 changed files with 81 additions and 118 deletions

View File

@@ -223,9 +223,7 @@ int main(int argc, char** argv) {
int framesSinceMasterStatus = 0;
int framesSinceShutdownSequence = 0;
int currentFramerate = highFrameRate;
int physicsFramerate = highFrameRate;
int physicsStepRate = 0;
int physicsStepCount = 0;
int ghostingStepCount = 0;
auto ghostingLastTime = std::chrono::high_resolution_clock::now();
@@ -300,9 +298,6 @@ int main(int argc, char** argv) {
{
currentFramerate = PerformanceManager::GetServerFramerate();
}
physicsFramerate = PerformanceManager::GetPhysicsFramerate();
physicsStepRate = PerformanceManager::GetPhysicsStepRate();
//Warning if we ran slow
if (deltaTime > currentFramerate) {
@@ -338,10 +333,7 @@ int main(int argc, char** argv) {
if (zoneID != 0 && deltaTime > 0.0f) {
Metrics::StartMeasurement(MetricVariable::Physics);
if (physicsStepCount++ >= physicsStepRate) {
dpWorld::Instance().StepWorld(deltaTime);
physicsStepCount = 0;
}
dpWorld::Instance().StepWorld(deltaTime);
Metrics::EndMeasurement(MetricVariable::Physics);
Metrics::StartMeasurement(MetricVariable::UpdateEntities);