summaryrefslogtreecommitdiff
path: root/scene/resources/plane_shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/plane_shape.cpp')
-rw-r--r--scene/resources/plane_shape.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/scene/resources/plane_shape.cpp b/scene/resources/plane_shape.cpp
index 150406ceff..760a36a91e 100644
--- a/scene/resources/plane_shape.cpp
+++ b/scene/resources/plane_shape.cpp
@@ -30,7 +30,34 @@
#include "servers/physics_server.h"
-
+Vector<Vector3> PlaneShape::_gen_debug_mesh_lines() {
+
+ Plane p = get_plane();
+ Vector<Vector3> points;
+
+ Vector3 n1 = p.get_any_perpendicular_normal();
+ Vector3 n2 = p.normal.cross(n1).normalized();
+
+ Vector3 pface[4]={
+ p.normal*p.d+n1*10.0+n2*10.0,
+ p.normal*p.d+n1*10.0+n2*-10.0,
+ p.normal*p.d+n1*-10.0+n2*-10.0,
+ p.normal*p.d+n1*-10.0+n2*10.0,
+ };
+
+ points.push_back(pface[0]);
+ points.push_back(pface[1]);
+ points.push_back(pface[1]);
+ points.push_back(pface[2]);
+ points.push_back(pface[2]);
+ points.push_back(pface[3]);
+ points.push_back(pface[3]);
+ points.push_back(pface[0]);
+ points.push_back(p.normal*p.d);
+ points.push_back(p.normal*p.d+p.normal*3);
+
+ return points;
+}
void PlaneShape::_update_shape() {