Skip to content

Commit

Permalink
Fix indices winding in convex hull generator
Browse files Browse the repository at this point in the history
Invert indices to match Godot's winding like the previous QuickHull
algorithm was doing.
  • Loading branch information
pouleyKetchoupp committed Jul 7, 2021
1 parent 56d7126 commit e238ed6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/math/convex_hull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2275,12 +2275,12 @@ Error ConvexHullComputer::convex_hull(const Vector<Vector3> &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.");
}
Expand Down

0 comments on commit e238ed6

Please sign in to comment.