optimization for when physics engine doesn't step

This commit is contained in:
Andrew Meadows 2015-01-27 15:54:32 -08:00
parent aebdd3b335
commit d5c0c200de
2 changed files with 22 additions and 17 deletions

View file

@ -29,6 +29,9 @@ PhysicsEngine::~PhysicsEngine() {
// begin EntitySimulation overrides
void PhysicsEngine::updateEntitiesInternal(const quint64& now) {
// no need to send updates unless the physics simulation has actually stepped
if (_lastNumSubstepsAtUpdateInternal != _numSubsteps) {
_lastNumSubstepsAtUpdateInternal = _numSubsteps;
// NOTE: the grand order of operations is:
// (1) relay incoming changes
// (2) step simulation
@ -48,6 +51,7 @@ void PhysicsEngine::updateEntitiesInternal(const quint64& now) {
++stateItr;
}
}
}
}
void PhysicsEngine::addEntityInternal(EntityItem* entity) {

View file

@ -114,6 +114,7 @@ private:
ContactMap _contactMap;
uint32_t _numContactFrames = 0;
uint32_t _lastNumSubstepsAtUpdateInternal = 0;
};
#endif // hifi_PhysicsEngine_h