mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:57:30 +02:00
workaround for bad physics polling on login
This commit is contained in:
parent
895f79fd80
commit
0f4e7fb532
1 changed files with 14 additions and 7 deletions
|
@ -5639,10 +5639,10 @@ bool Application::nearbyEntitiesAreReadyForPhysics() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AABox avatarBox(getMyAvatar()->getPosition() - glm::vec3(0.5f * PHYSICS_READY_RANGE), glm::vec3(PHYSICS_READY_RANGE));
|
||||||
QVector<EntityItemPointer> entities;
|
QVector<EntityItemPointer> entities;
|
||||||
entityTree->withReadLock([&] {
|
entityTree->withReadLock([&] {
|
||||||
AABox box(getMyAvatar()->getPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE));
|
entityTree->findEntities(avatarBox, entities);
|
||||||
entityTree->findEntities(box, entities);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// For reasons I haven't found, we don't necessarily have the full scene when we receive a stats packet. Apply
|
// 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() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
foreach (EntityItemPointer entity, entities) {
|
foreach (EntityItemPointer entity, entities) {
|
||||||
if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) {
|
if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) {
|
||||||
static QString repeatedMessage =
|
// BUG: the findEntities() query above is sometimes returning objects that don't actually overlap
|
||||||
LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*");
|
// TODO: investigate and fix findQueries() but in the meantime...
|
||||||
qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName();
|
// WORKAROUND: test the overlap of each entity to verify it matters
|
||||||
// don't break here because we want all the relevant entities to start their downloads
|
bool success = false;
|
||||||
result = false;
|
AACube entityCube = entity->getQueryAACube(success);
|
||||||
|
if (success && avatarBox.touches(entityCube)) {
|
||||||
|
static QString repeatedMessage =
|
||||||
|
LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*");
|
||||||
|
qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName();
|
||||||
|
// don't break here because we want all the relevant entities to start their downloads
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue