when a parent moves, check children vs their queryAACubes

This commit is contained in:
Seth Alves 2015-12-18 16:06:51 -08:00
parent 7689453ba2
commit 3782c21b45

View file

@ -296,6 +296,8 @@ void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success) {
});
if (success) {
locationChanged();
} else {
qDebug() << "setPosition failed for" << getID();
}
}
@ -554,6 +556,18 @@ bool SpatiallyNestable::queryAABoxNeedsUpdate() const {
qDebug() << "can't getMaximumAACube for" << getID();
return false;
}
// make sure children are still in their boxes, also.
bool childNeedsUpdate = false;
getThisPointer()->forEachDescendant([&](SpatiallyNestablePointer descendant) {
if (descendant->queryAABoxNeedsUpdate()) {
childNeedsUpdate = true;
}
});
if (childNeedsUpdate) {
return true;
}
if (_queryAACubeSet && _queryAACube.contains(currentAACube)) {
return false;
}