From 088da60116f678c84a9eff2b179af525e4c45394 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 10 Dec 2022 17:07:31 +0100 Subject: [PATCH] Added epsilon for dimensions of sphere in SphereCollapse --- libraries/physics/src/MultiSphereShape.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/physics/src/MultiSphereShape.cpp b/libraries/physics/src/MultiSphereShape.cpp index 372c2e8ec8..42de501eef 100644 --- a/libraries/physics/src/MultiSphereShape.cpp +++ b/libraries/physics/src/MultiSphereShape.cpp @@ -210,6 +210,7 @@ MultiSphereShape::CollapsingMode MultiSphereShape::computeSpheres(ExtractionMode auto& diff = data._diff; auto& epsilon = data._epsilon; auto& dimensions = data._dimensions; + const float DIMENSIONS_EPSILON = 0.000001f; if (_mode == ExtractionMode::Automatic) { if (diff.xy < 0.5f * epsilon.xy && diff.xz < 0.5f * epsilon.xz && diff.yz < 0.5f * epsilon.yz) { @@ -243,7 +244,7 @@ MultiSphereShape::CollapsingMode MultiSphereShape::computeSpheres(ExtractionMode break; case ExtractionMode::SphereCollapse: sphere._radius = 0.5f * glm::min(glm::min(dimensions.x, dimensions.y), dimensions.z); - if (sphere._radius > 0.0f) { + if (sphere._radius > DIMENSIONS_EPSILON) { sphere._position = glm::vec3(0.0f); _spheres.push_back(sphere); } else {