summaryrefslogtreecommitdiffstats
path: root/scene/3d/area.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-11-13 00:53:12 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-11-13 00:53:12 -0300
commitabbea4d945bbb1114570c3b6c7f649e01ca8ebb8 (patch)
treed2b131b32705bbcf118efa72d5d9a21618c1227e /scene/3d/area.cpp
parentd02953c5963ca080d26500ea8250e0632a80b234 (diff)
downloadredot-engine-abbea4d945bbb1114570c3b6c7f649e01ca8ebb8.tar.gz
UDP Fixes
-=-=-=-=- Curse the day I decided to port UDP code, as it ended up being two nights of work. At least It's done now (I hope). -Fixed UDP Support, API seems stable -Added UDP Chat demo (chat that can lose your packets, heh) -Added helpers to areas and bodies to get list of collided bodies and contained bodies. -Sped up screen/viewport capture code. -Added code to save an image as PNG -Small fix so scripts register their singletons after modules did.
Diffstat (limited to 'scene/3d/area.cpp')
-rw-r--r--scene/3d/area.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index 407747fc0d..cb1df78fda 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -255,6 +255,24 @@ bool Area::is_monitoring_enabled() const {
}
+Array Area::get_overlapping_bodies() const {
+
+ ERR_FAIL_COND_V(!monitoring,Array());
+ Array ret;
+ ret.resize(body_map.size());
+ int idx=0;
+ for (const Map<ObjectID,BodyState>::Element *E=body_map.front();E;E=E->next()) {
+ Object *obj = ObjectDB::get_instance(E->key());
+ if (!obj) {
+ ret.resize( ret.size() -1 ); //ops
+ } else {
+ ret[idx++]=obj;
+ }
+
+ }
+
+ return ret;
+}
void Area::_bind_methods() {
@@ -283,6 +301,8 @@ void Area::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_enable_monitoring","enable"),&Area::set_enable_monitoring);
ObjectTypeDB::bind_method(_MD("is_monitoring_enabled"),&Area::is_monitoring_enabled);
+ ObjectTypeDB::bind_method(_MD("get_overlapping_bodies"),&Area::get_overlapping_bodies);
+
ObjectTypeDB::bind_method(_MD("_body_inout"),&Area::_body_inout);