Merge pull request #36978 from lupoDharkael/opti-trimesh
Loop over faces in create_trimesh_shape()
This commit is contained in:
commit
153a2b094c
1 changed files with 4 additions and 2 deletions
|
@ -252,10 +252,12 @@ Ref<Shape> Mesh::create_trimesh_shape() const {
|
||||||
Vector<Vector3> face_points;
|
Vector<Vector3> face_points;
|
||||||
face_points.resize(faces.size() * 3);
|
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);
|
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);
|
Ref<ConcavePolygonShape> shape = memnew(ConcavePolygonShape);
|
||||||
|
|
Loading…
Reference in a new issue