diff options
Diffstat (limited to 'scene/3d/area.cpp')
-rw-r--r-- | scene/3d/area.cpp | 20 |
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); |