File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -115,21 +115,19 @@ namespace omath::collision
115115 out.iterations = it + 1 ;
116116 }
117117
118- // Fallback: pick closest face as best-effort answer
119- if (!faces.empty ())
120- {
121- const auto best = *std::ranges::min_element (faces, [](const auto & first, const auto & second)
122- { return first.d < second.d ; });
123- out.normal = best.n ;
124- out.depth = best.d ;
125- out.num_vertices = static_cast <int >(vertexes.size ());
126- out.num_faces = static_cast <int >(faces.size ());
118+ if (faces.empty ())
119+ return std::nullopt ;
127120
128- out.penetration_vector = out.normal * out.depth ;
121+ const auto best = *std::ranges::min_element (faces, [](const auto & first, const auto & second)
122+ { return first.d < second.d ; });
123+ out.normal = best.n ;
124+ out.depth = best.d ;
125+ out.num_vertices = static_cast <int >(vertexes.size ());
126+ out.num_faces = static_cast <int >(faces.size ());
129127
130- return out;
131- }
132- return std:: nullopt ;
128+ out. penetration_vector = out. normal * out. depth ;
129+
130+ return out ;
133131 }
134132
135133 private:
You can’t perform that action at this time.
0 commit comments