From 3782c21b4552cd7ac9c59d83b6adf559962cc637 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 18 Dec 2015 16:06:51 -0800 Subject: [PATCH] when a parent moves, check children vs their queryAACubes --- libraries/shared/src/SpatiallyNestable.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index af889b8245..48e9b14271 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -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; }