diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 0bd134bef5..292e4c637e 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -540,6 +540,7 @@ glm::quat Avatar::computeRotationFromBodyToWorldUp(float proportion) const { } void Avatar::fixupModelsInScene() { + _attachmentsToDelete.clear(); // check to see if when we added our models to the scene they were ready, if they were not ready, then // fix them up in the scene @@ -560,9 +561,11 @@ void Avatar::fixupModelsInScene() { attachmentModel->addToScene(scene, pendingChanges); } } + for (auto& attachmentModelToRemove : _attachmentsToRemove) { attachmentModelToRemove->removeFromScene(scene, pendingChanges); } + _attachmentsToDelete.insert(_attachmentsToDelete.end(), _attachmentsToRemove.begin(), _attachmentsToRemove.end()); _attachmentsToRemove.clear(); scene->enqueuePendingChanges(pendingChanges); } diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index cd9fc86e1e..f9e21febd5 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -193,6 +193,7 @@ protected: glm::vec3 _skeletonOffset; std::vector> _attachmentModels; std::vector> _attachmentsToRemove; + std::vector> _attachmentsToDelete; float _bodyYawDelta; // degrees/sec