Browse Source

Avoid memory corruption when GodotConvexPolygonShape3D is setup more than once

Mariano Javier Suligoy 2 years ago
parent
commit
a39ac1383b
1 changed files with 2 additions and 0 deletions
  1. 2 0
      servers/physics_3d/godot_shape_3d.cpp

+ 2 - 0
servers/physics_3d/godot_shape_3d.cpp

@@ -1085,6 +1085,8 @@ void GodotConvexPolygonShape3D::_setup(const Vector<Vector3> &p_vertices) {
 	if (err != OK) {
 		ERR_PRINT("Failed to build convex hull");
 	}
+	extreme_vertices.resize(0);
+	vertex_neighbors.resize(0);
 
 	AABB _aabb;