summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/mesh.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index a063b7f74f..1caeddd881 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -252,10 +252,12 @@ Ref<Shape> Mesh::create_trimesh_shape() const {
Vector<Vector3> 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<ConcavePolygonShape> shape = memnew(ConcavePolygonShape);