Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -5639,10 +5639,10 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { · 5638 unmodified lines | ||
| 5639 | 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 | 5643 | QVector<EntityItemPointer> entities; |
| 5643 | 5644 | entityTree->withReadLock([&] { |
| 5644 | − AABox box(getMyAvatar()->getPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); | |
| 5645 | − entityTree->findEntities(box, entities); | |
| 5645 | + entityTree->findEntities(avatarBox, entities); | |
| 5646 | 5646 | }); |
| 5647 | 5647 | |
| 5648 | 5648 | // 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 | 5662 | bool result = true; |
| 5663 | 5663 | foreach (EntityItemPointer entity, entities) { |
| 5664 | 5664 | if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) { |
| 5665 | − static QString repeatedMessage = | |
| 5666 | − LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*"); | |
| 5667 | − qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName(); | |
| 5668 | − // don't break here because we want all the relevant entities to start their downloads | |
| 5669 | − result = false; | |
| 5665 | + // BUG: the findEntities() query above is sometimes returning objects that don't actually overlap | |
| 5666 | + // TODO: investigate and fix findQueries() but in the meantime... | |
| 5667 | + // WORKAROUND: test the overlap of each entity to verify it matters | |
| 5668 | + bool success = 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 | 5679 | return result; |