fix out of order physics updates

fixes an issue where physics entities were not given a chance to be marked as sleeping, causing a initial sleeping calls to be missed and causing objects that collided with one another to not register new collisions since they were sleeping at the time the new collision fired off.

Tested that Brick Fury now corectly aggros the _first_ spawn of enemies near by to him.
Tested that the turrets in crux prime now correctly shoot the _first_ wave of enemies that spawn.
This commit is contained in:
David Markowitz 2024-04-30 23:09:35 -07:00
parent 35c463656d
commit 58cc569c75

View File

@ -388,14 +388,14 @@ int main(int argc, char** argv) {
//In world we'd update our other systems here. //In world we'd update our other systems here.
if (zoneID != 0 && deltaTime > 0.0f) { if (zoneID != 0 && deltaTime > 0.0f) {
Metrics::StartMeasurement(MetricVariable::Physics);
dpWorld::StepWorld(deltaTime);
Metrics::EndMeasurement(MetricVariable::Physics);
Metrics::StartMeasurement(MetricVariable::UpdateEntities); Metrics::StartMeasurement(MetricVariable::UpdateEntities);
Game::entityManager->UpdateEntities(deltaTime); Game::entityManager->UpdateEntities(deltaTime);
Metrics::EndMeasurement(MetricVariable::UpdateEntities); Metrics::EndMeasurement(MetricVariable::UpdateEntities);
Metrics::StartMeasurement(MetricVariable::Physics);
dpWorld::StepWorld(deltaTime);
Metrics::EndMeasurement(MetricVariable::Physics);
Metrics::StartMeasurement(MetricVariable::Ghosting); Metrics::StartMeasurement(MetricVariable::Ghosting);
if (std::chrono::duration<float>(currentTime - ghostingLastTime).count() >= 1.0f) { if (std::chrono::duration<float>(currentTime - ghostingLastTime).count() >= 1.0f) {
Game::entityManager->UpdateGhosting(); Game::entityManager->UpdateGhosting();