diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-09-20 13:03:46 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-09-20 13:03:46 -0300 |
commit | 83d9a692be648668b5b363f2424c619e15639843 (patch) | |
tree | 387b30810994b282c795fdd011f53f0b7eb93ace /scene/resources/concave_polygon_shape.cpp | |
parent | 3f9e5afe68df1e3b4bcf34a21468ed55a57a7973 (diff) | |
parent | 889d21e0049a0e84d6d44db9b80193f93fd62f17 (diff) |
Ability to visually debug geometry visually:
-Visible 2D and 3D Shapes, Polygons, Tile collisions, etc.
-Visible Navmesh and Navpoly
-Visible collision contacts for 2D and 3D as a red point
-Customizable colors in project settings
Diffstat (limited to 'scene/resources/concave_polygon_shape.cpp')
-rw-r--r-- | scene/resources/concave_polygon_shape.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index 55bd5de690..7aeac04a22 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -30,6 +30,40 @@ #include "servers/physics_server.h" +Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() { + + Set<DrawEdge> edges; + + DVector<Vector3> data=get_faces(); + int datalen=data.size(); + ERR_FAIL_COND_V( (datalen%3)!=0,Vector<Vector3>() ); + + DVector<Vector3>::Read r=data.read(); + + for(int i=0;i<datalen;i+=3) { + + for(int j=0;j<3;j++) { + + DrawEdge de(r[i+j],r[i+((j+1)%3)]); + edges.insert(de); + } + + } + + Vector<Vector3> points; + points.resize(edges.size()*2); + int idx=0; + for (Set<DrawEdge>::Element*E=edges.front();E;E=E->next()) { + + points[idx+0]=E->get().a; + points[idx+1]=E->get().b; + idx+=2; + } + + return points; + +} + bool ConcavePolygonShape::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="data") |