History

workaround for bad physics polling on login

Andrew Meadows committed 9 years ago

Commit 0f4e7fb1 parent 895f79f1 file · +14 −7Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+14−7
@@ -5639,10 +5639,10 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { · 5638 unmodified lines
5639 return false;5639 return false;
5640 }5640 }
5641 5641
5642 AABox avatarBox(getMyAvatar()->getPosition() - glm::vec3(0.5f * PHYSICS_READY_RANGE), glm::vec3(PHYSICS_READY_RANGE));
5642 QVector<EntityItemPointer> entities;5643 QVector<EntityItemPointer> entities;
5643 entityTree->withReadLock([&] {5644 entityTree->withReadLock([&] {
5644 AABox box(getMyAvatar()->getPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE));5645 entityTree->findEntities(avatarBox, entities);
5645 entityTree->findEntities(box, entities);
5646 });5646 });
5647 5647
5648 // For reasons I haven't found, we don't necessarily have the full scene when we receive a stats packet. Apply5648 // For reasons I haven't found, we don't necessarily have the full scene when we receive a stats packet. Apply
@@ -5662,11 +5662,18 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { · 13 unmodified lines
5662 bool result = true;5662 bool result = true;
5663 foreach (EntityItemPointer entity, entities) {5663 foreach (EntityItemPointer entity, entities) {
5664 if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) {5664 if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) {
5665 static QString repeatedMessage =5665 // BUG: the findEntities() query above is sometimes returning objects that don't actually overlap
5666 LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*");5666 // TODO: investigate and fix findQueries() but in the meantime...
5667 qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName();5667 // WORKAROUND: test the overlap of each entity to verify it matters
5668 // don't break here because we want all the relevant entities to start their downloads5668 bool success = false;
5669 result = false;5669 AACube entityCube = entity->getQueryAACube(success);
5670 if (success && avatarBox.touches(entityCube)) {
5671 static QString repeatedMessage =
5672 LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*");
5673 qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName();
5674 // don't break here because we want all the relevant entities to start their downloads
5675 result = false;
5676 }
5670 }5677 }
5671 }5678 }
5672 return result;5679 return result;