added ability for Area (3D) to detect other areas

This commit is contained in:
Juan Linietsky
2015-06-12 15:52:21 -03:00
parent 8945670bc0
commit 89300b70e7
10 changed files with 500 additions and 22 deletions
+38
View File
@@ -53,6 +53,7 @@ private:
real_t density;
int priority;
bool monitoring;
bool monitorable;
bool locked;
@@ -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,7 +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;
Array get_overlapping_areas() const; //function for script
bool overlaps_area(Node* p_area) const;
bool overlaps_body(Node* p_body) const;
Area();