diff options
Diffstat (limited to 'scene/2d/area_2d.h')
-rw-r--r-- | scene/2d/area_2d.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index f770e88a19..6a6c757e0c 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -53,6 +53,7 @@ private: real_t angular_damp; int priority; bool monitoring; + bool monitorable; bool locked; void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape); @@ -84,6 +85,36 @@ private: Map<ObjectID,BodyState> body_map; + + + void _area_inout(int p_status,const RID& p_area, int p_instance, int p_area_shape,int p_self_shape); + + void _area_enter_tree(ObjectID p_id); + void _area_exit_tree(ObjectID p_id); + + struct AreaShapePair { + + int area_shape; + int self_shape; + bool operator<(const AreaShapePair& p_sp) const { + if (area_shape==p_sp.area_shape) + return self_shape < p_sp.self_shape; + else + return area_shape < p_sp.area_shape; + } + + AreaShapePair() {} + AreaShapePair(int p_bs, int p_as) { area_shape=p_bs; self_shape=p_as; } + }; + + struct AreaState { + + int rc; + bool in_tree; + VSet<AreaShapePair> shapes; + }; + + Map<ObjectID,AreaState> area_map; void _clear_monitoring(); @@ -117,8 +148,14 @@ public: void set_enable_monitoring(bool p_enable); bool is_monitoring_enabled() const; + void set_monitorable(bool p_enable); + bool is_monitorable() const; + Array get_overlapping_bodies() const; //function for script + Array get_overlapping_areas() const; //function for script + bool overlaps_area(Node* p_area) const; + bool overlaps_body(Node* p_body) const; Area2D(); ~Area2D(); |