From cbf82a6f2cd2f74a4f2be47c9acfe01273a76bd6 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Thu, 24 Aug 2017 13:32:44 -0700 Subject: [PATCH] fix timeout for physics check --- interface/src/Application.cpp | 6 +----- interface/src/Application.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 85172fc73f..6762217485 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4859,13 +4859,9 @@ void Application::update(float deltaTime) { // we haven't yet enabled physics. we wait until we think we have all the collision information // for nearby entities before starting bullet up. quint64 now = usecTimestampNow(); - bool timeout = false; const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND; - if (_lastPhysicsCheckTime > 0 && now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT) { - timeout = true; - } - if (timeout || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { + if (now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway _lastPhysicsCheckTime = now; _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; diff --git a/interface/src/Application.h b/interface/src/Application.h index 74e84ae92c..93f7a4ab79 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -659,7 +659,7 @@ private: uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 }; // _fullSceneReceivedCounter last time we checked physics ready uint32_t _nearbyEntitiesCountAtLastPhysicsCheck { 0 }; // how many in-range entities last time we checked physics ready uint32_t _nearbyEntitiesStabilityCount { 0 }; // how many times has _nearbyEntitiesCountAtLastPhysicsCheck been the same - quint64 _lastPhysicsCheckTime { 0 }; // when did we last check to see if physics was ready + quint64 _lastPhysicsCheckTime { usecTimestampNow() }; // when did we last check to see if physics was ready bool _keyboardDeviceHasFocus { true };