From 536c2fc0c0895a152676cfe1cd22054ecefafd96 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Wed, 11 Mar 2020 00:33:39 +0100 Subject: [PATCH] Loop over faces in create_trimesh_shape() (cherry picked from commit ee0262977e21c416053c9fe41003e680f2e34ff9) --- scene/resources/mesh.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 05999203036..f8a4f731cba 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -254,10 +254,12 @@ Ref Mesh::create_trimesh_shape() const { PoolVector face_points; face_points.resize(faces.size() * 3); - for (int i = 0; i < face_points.size(); i++) { + for (int i = 0; i < face_points.size(); i += 3) { Face3 f = faces.get(i / 3); - face_points.set(i, f.vertex[i % 3]); + face_points.set(i, f.vertex[0]); + face_points.set(i + 1, f.vertex[1]); + face_points.set(i + 2, f.vertex[2]); } Ref shape = memnew(ConcavePolygonShape);