From ac9229ace03330cee264908ee33e5b52d2789c7a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sun, 29 Aug 2021 21:34:31 +1200 Subject: [PATCH 1/3] Fix avatar crash --- libraries/physics/src/MultiSphereShape.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/physics/src/MultiSphereShape.cpp b/libraries/physics/src/MultiSphereShape.cpp index ca5346cd4c..1d2525741c 100644 --- a/libraries/physics/src/MultiSphereShape.cpp +++ b/libraries/physics/src/MultiSphereShape.cpp @@ -486,7 +486,10 @@ void MultiSphereShape::calculateDebugLines() { break; } } - } + } + if (radiuses.size() == 0) { + radiuses.push_back(0.0f); + } calculateChamferBox(_debugLines, radiuses, axes, _midPoint); } else if (_spheres.size() == 8) { std::vector axes; From e3c28a5dc8b51306e5ea6ea2fe345af2a6848734 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 6 Sep 2021 16:28:38 +1200 Subject: [PATCH 2/3] Alternative crash fix --- libraries/physics/src/MultiSphereShape.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/physics/src/MultiSphereShape.cpp b/libraries/physics/src/MultiSphereShape.cpp index 1d2525741c..ce00a7c40f 100644 --- a/libraries/physics/src/MultiSphereShape.cpp +++ b/libraries/physics/src/MultiSphereShape.cpp @@ -487,9 +487,6 @@ void MultiSphereShape::calculateDebugLines() { } } } - if (radiuses.size() == 0) { - radiuses.push_back(0.0f); - } calculateChamferBox(_debugLines, radiuses, axes, _midPoint); } else if (_spheres.size() == 8) { std::vector axes; @@ -512,6 +509,11 @@ void MultiSphereShape::connectEdges(std::vector> void MultiSphereShape::calculateChamferBox(std::vector>& outLines, const std::vector& radiuses, const std::vector& axes, const glm::vec3& translation) { std::vector> sphereLines; + + if (radiuses.size() == 0) { + return; + } + calculateSphereLines(sphereLines, glm::vec3(0.0f), radiuses[0]); std::vector regions = { From 96708f5fe3c1d85474338b2a602882304ad0ccd4 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Sep 2021 18:58:37 +1200 Subject: [PATCH 3/3] Move crash fix --- libraries/physics/src/MultiSphereShape.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/physics/src/MultiSphereShape.cpp b/libraries/physics/src/MultiSphereShape.cpp index ce00a7c40f..71702ac62b 100644 --- a/libraries/physics/src/MultiSphereShape.cpp +++ b/libraries/physics/src/MultiSphereShape.cpp @@ -508,12 +508,11 @@ void MultiSphereShape::connectEdges(std::vector> } void MultiSphereShape::calculateChamferBox(std::vector>& outLines, const std::vector& radiuses, const std::vector& axes, const glm::vec3& translation) { - std::vector> sphereLines; - if (radiuses.size() == 0) { return; } + std::vector> sphereLines; calculateSphereLines(sphereLines, glm::vec3(0.0f), radiuses[0]); std::vector regions = {