summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-04-06 08:15:22 +0200
committerGitHub <noreply@github.com>2018-04-06 08:15:22 +0200
commitbdfa10fc8f6ecc4e4824ca9bb32ece782ede1b43 (patch)
treebded8078e5ccc076b117ef7f99de4470c347bb33 /modules
parent31fd1b7711aa4c6f91181e2d9bf00f2261d2b79c (diff)
parent776942981bea7f396ad6416a71e65b6af0cb4dd8 (diff)
Merge pull request #17899 from AndreaCatania/area_cleaning
Fixed physics server area cleaning
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/area_bullet.cpp8
-rw-r--r--modules/bullet/area_bullet.h2
-rw-r--r--modules/bullet/collision_object_bullet.cpp6
3 files changed, 8 insertions, 8 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index 648919e612..ec78cddb6a 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -68,7 +68,8 @@ AreaBullet::AreaBullet() :
}
AreaBullet::~AreaBullet() {
- remove_all_overlapping_instantly();
+ // Call "remove_all_overlapping_instantly();" is not necessary because the exit
+ // signal are handled by godot, so just clear the array
}
void AreaBullet::dispatch_callbacks() {
@@ -131,12 +132,13 @@ void AreaBullet::remove_all_overlapping_instantly() {
overlappingObjects.clear();
}
-void AreaBullet::remove_overlapping_instantly(CollisionObjectBullet *p_object) {
+void AreaBullet::remove_overlapping_instantly(CollisionObjectBullet *p_object, bool p_notify) {
CollisionObjectBullet *supportObject;
for (int i = overlappingObjects.size() - 1; 0 <= i; --i) {
supportObject = overlappingObjects[i].object;
if (supportObject == p_object) {
- call_event(supportObject, PhysicsServer::AREA_BODY_REMOVED);
+ if (p_notify)
+ call_event(supportObject, PhysicsServer::AREA_BODY_REMOVED);
supportObject->on_exit_area(this);
overlappingObjects.remove(i);
break;
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index 78136d574b..4104780de9 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -152,7 +152,7 @@ public:
void remove_all_overlapping_instantly();
// Dispatch the callbacks and removes from overlapping list
- void remove_overlapping_instantly(CollisionObjectBullet *p_object);
+ void remove_overlapping_instantly(CollisionObjectBullet *p_object, bool p_notify);
virtual void on_collision_filters_change();
virtual void on_collision_checker_start() {}
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp
index 34aff68a4a..77f8df34cb 100644
--- a/modules/bullet/collision_object_bullet.cpp
+++ b/modules/bullet/collision_object_bullet.cpp
@@ -68,12 +68,10 @@ CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
force_shape_reset(false) {}
CollisionObjectBullet::~CollisionObjectBullet() {
- // Remove all overlapping
+ // Remove all overlapping, notify is not required since godot take care of it
for (int i = areasOverlapped.size() - 1; 0 <= i; --i) {
- areasOverlapped[i]->remove_overlapping_instantly(this);
+ areasOverlapped[i]->remove_overlapping_instantly(this, /*Notify*/ false);
}
- // not required
- // areasOverlapped.clear();
destroyBulletCollisionObject();
}