summaryrefslogtreecommitdiff
path: root/scene/resources/sphere_shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/sphere_shape.cpp')
-rw-r--r--scene/resources/sphere_shape.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp
index e93d718efa..a7e28eb727 100644
--- a/scene/resources/sphere_shape.cpp
+++ b/scene/resources/sphere_shape.cpp
@@ -29,6 +29,30 @@
#include "sphere_shape.h"
#include "servers/physics_server.h"
+Vector<Vector3> SphereShape::_gen_debug_mesh_lines() {
+
+ float r=get_radius();
+
+ Vector<Vector3> points;
+
+ for(int i=0;i<=360;i++) {
+
+ float ra=Math::deg2rad(i);
+ float rb=Math::deg2rad(i+1);
+ Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r;
+ Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r;
+
+ points.push_back(Vector3(a.x,0,a.y));
+ points.push_back(Vector3(b.x,0,b.y));
+ points.push_back(Vector3(0,a.x,a.y));
+ points.push_back(Vector3(0,b.x,b.y));
+ points.push_back(Vector3(a.x,a.y,0));
+ points.push_back(Vector3(b.x,b.y,0));
+
+ }
+
+ return points;
+}
void SphereShape::_update_shape() {