From e238ed64ab3f4f81f460c205b05c1e5d238676a3 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 7 Jul 2021 10:09:32 -0700 Subject: [PATCH] Fix indices winding in convex hull generator Invert indices to match Godot's winding like the previous QuickHull algorithm was doing. --- core/math/convex_hull.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp index 682a7ea39eed..4d8875bba07c 100644 --- a/core/math/convex_hull.cpp +++ b/core/math/convex_hull.cpp @@ -2275,12 +2275,12 @@ Error ConvexHullComputer::convex_hull(const Vector &p_points, Geometry3 do { face.indices.push_back(e->get_target_vertex()); - e = e->get_next_edge_of_face(); + e = e->get_next_edge_of_vertex(); } while (e != e_start); - // compute normal + // Compute normal. if (face.indices.size() >= 3) { - face.plane = Plane(r_mesh.vertices[face.indices[0]], r_mesh.vertices[face.indices[2]], r_mesh.vertices[face.indices[1]]); + face.plane = Plane(r_mesh.vertices[face.indices[0]], r_mesh.vertices[face.indices[1]], r_mesh.vertices[face.indices[2]]); } else { WARN_PRINT("Too few vertices per face."); }