summaryrefslogtreecommitdiff
path: root/scene/resources/convex_polygon_shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/convex_polygon_shape.cpp')
-rw-r--r--scene/resources/convex_polygon_shape.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp
index 326a0e5180..6a405c9c94 100644
--- a/scene/resources/convex_polygon_shape.cpp
+++ b/scene/resources/convex_polygon_shape.cpp
@@ -28,7 +28,34 @@
/*************************************************************************/
#include "convex_polygon_shape.h"
#include "servers/physics_server.h"
+#include "quick_hull.h"
+Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() {
+
+ DVector<Vector3> points = get_points();
+
+ if (points.size()>3) {
+
+ QuickHull qh;
+ Vector<Vector3> varr = Variant(points);
+ Geometry::MeshData md;
+ Error err = qh.build(varr,md);
+ if (err==OK) {
+ Vector<Vector3> lines;
+ lines.resize(md.edges.size()*2);
+ for(int i=0;i<md.edges.size();i++) {
+ lines[i*2+0]=md.vertices[md.edges[i].a];
+ lines[i*2+1]=md.vertices[md.edges[i].b];
+ }
+ return lines;
+
+
+ }
+
+ }
+
+ return Vector<Vector3>();
+}
void ConvexPolygonShape::_update_shape() {