summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorlupoDharkael <izhe@hotmail.es>2020-03-11 00:33:39 +0100
committerlupoDharkael <izhe@hotmail.es>2020-03-11 00:33:39 +0100
commitee0262977e21c416053c9fe41003e680f2e34ff9 (patch)
tree2f281b740e42dd65ed3b65a7d73b45a372b3f393 /scene/resources
parent478337c412f767b908820d7bb56c786bf0b909cb (diff)
Loop over faces in create_trimesh_shape()
Diffstat (limited to 'scene/resources')
-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);