summaryrefslogtreecommitdiff
path: root/scene/resources/rectangle_shape_2d.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-09-20 13:03:46 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-09-20 13:03:46 -0300
commit83d9a692be648668b5b363f2424c619e15639843 (patch)
tree387b30810994b282c795fdd011f53f0b7eb93ace /scene/resources/rectangle_shape_2d.cpp
parent3f9e5afe68df1e3b4bcf34a21468ed55a57a7973 (diff)
parent889d21e0049a0e84d6d44db9b80193f93fd62f17 (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/rectangle_shape_2d.cpp')
-rw-r--r--scene/resources/rectangle_shape_2d.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp
index d3332f45a5..9a32b013c1 100644
--- a/scene/resources/rectangle_shape_2d.cpp
+++ b/scene/resources/rectangle_shape_2d.cpp
@@ -29,7 +29,7 @@
#include "rectangle_shape_2d.h"
#include "servers/physics_2d_server.h"
-
+#include "servers/visual_server.h"
void RectangleShape2D::_update_shape() {
Physics2DServer::get_singleton()->shape_set_data(get_rid(),extents);
@@ -48,6 +48,19 @@ Vector2 RectangleShape2D::get_extents() const {
return extents;
}
+void RectangleShape2D::draw(const RID& p_to_rid,const Color& p_color) {
+
+
+ VisualServer::get_singleton()->canvas_item_add_rect(p_to_rid,Rect2(-extents,extents*2.0),p_color);
+
+}
+
+Rect2 RectangleShape2D::get_rect() const {
+
+ Rect2(-extents,extents*2.0);
+
+}
+
void RectangleShape2D::_bind_methods() {