summaryrefslogtreecommitdiff
path: root/servers/physics_2d/space_2d_sw.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics_2d/space_2d_sw.h')
-rw-r--r--servers/physics_2d/space_2d_sw.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index abee8628fc..97ad3d7f80 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -103,6 +103,9 @@ class Space2DSW {
int _cull_aabb_for_body(Body2DSW *p_body,const Rect2& p_aabb);
+ Vector<Vector2> contact_debug;
+ int contact_debug_count;
+
friend class Physics2DDirectSpaceStateSW;
public:
@@ -169,6 +172,14 @@ public:
bool test_body_motion(Body2DSW *p_body, const Vector2&p_motion, float p_margin, Physics2DServer::MotionResult *r_result);
+
+ void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
+ _FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
+ _FORCE_INLINE_ void add_debug_contact(const Vector2& p_contact) { if (contact_debug_count<contact_debug.size()) contact_debug[contact_debug_count++]=p_contact; }
+ _FORCE_INLINE_ Vector<Vector2> get_debug_contacts() { return contact_debug; }
+ _FORCE_INLINE_ int get_debug_contact_count() { return contact_debug_count; }
+
+
Physics2DDirectSpaceStateSW *get_direct_state();
Space2DSW();