use parentChanged to recalculate entity bounding boxes

This commit is contained in:
Seth Alves 2015-11-04 09:27:57 -08:00
parent ffb0317a50
commit 9b3708ea66
4 changed files with 9 additions and 2 deletions

View file

@ -1324,6 +1324,12 @@ void EntityItem::forSelfAndEachChildEntity(std::function<void(EntityItemPointer)
}
}
void EntityItem::parentChanged() {
forSelfAndEachChildEntity([&](EntityItemPointer entity) {
entity->requiresRecalcBoxes();
});
}
void EntityItem::updatePosition(const glm::vec3& value) {
if (shouldSuppressLocationEdits()) {
return;

View file

@ -398,6 +398,7 @@ protected:
void setActionDataInternal(QByteArray actionData);
void forSelfAndEachChildEntity(std::function<void(EntityItemPointer)> actor);
virtual void parentChanged();
static bool _sendPhysicsUpdates;
EntityTypes::EntityType _type;

View file

@ -71,7 +71,7 @@ SpatiallyNestablePointer SpatiallyNestable::getParentPointer() const {
}
if (parent || _parentID.isNull()) {
parentChanged();
thisPointer->parentChanged();
}
return parent;

View file

@ -92,7 +92,7 @@ protected:
virtual void forgetChild(SpatiallyNestablePointer newChild) const;
mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children;
virtual void parentChanged() const {} // called when parent pointer is updated
virtual void parentChanged() {} // called when parent pointer is updated
private:
Transform _transform; // this is to be combined with parent's world-transform to produce this' world-transform.