summaryrefslogtreecommitdiff
path: root/modules/bullet/area_bullet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/area_bullet.cpp')
-rw-r--r--modules/bullet/area_bullet.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index 79d8e252f0..b35019bea3 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -65,14 +65,11 @@ AreaBullet::~AreaBullet() {
}
void AreaBullet::dispatch_callbacks() {
- if (!isScratched) {
- return;
- }
- isScratched = false;
+ RigidCollisionObjectBullet::dispatch_callbacks();
// Reverse order because I've to remove EXIT objects
for (int i = overlappingObjects.size() - 1; 0 <= i; --i) {
- OverlappingObjectData &otherObj = overlappingObjects.write[i];
+ OverlappingObjectData &otherObj = overlappingObjects[i];
switch (otherObj.state) {
case OVERLAP_STATE_ENTER:
@@ -112,10 +109,9 @@ void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3
}
void AreaBullet::scratch() {
- if (isScratched) {
- return;
+ if (space != nullptr) {
+ space->add_to_pre_flush_queue(this);
}
- isScratched = true;
}
void AreaBullet::clear_overlaps(bool p_notify) {
@@ -164,7 +160,7 @@ void AreaBullet::main_shape_changed() {
btGhost->setCollisionShape(get_main_shape());
}
-void AreaBullet::reload_body() {
+void AreaBullet::do_reload_body() {
if (space) {
space->remove_area(this);
space->add_area(this);
@@ -173,21 +169,25 @@ void AreaBullet::reload_body() {
void AreaBullet::set_space(SpaceBullet *p_space) {
// Clear the old space if there is one
+
if (space) {
- isScratched = false;
+ clear_overlaps(false);
// Remove this object form the physics world
+ space->unregister_collision_object(this);
space->remove_area(this);
}
space = p_space;
if (space) {
- space->add_area(this);
+ space->register_collision_object(this);
+ reload_body();
+ scratch();
}
}
-void AreaBullet::on_collision_filters_change() {
+void AreaBullet::do_reload_collision_filters() {
if (space) {
space->reload_collision_filters(this);
}
@@ -201,13 +201,13 @@ void AreaBullet::add_overlap(CollisionObjectBullet *p_otherObject) {
void AreaBullet::put_overlap_as_exit(int p_index) {
scratch();
- overlappingObjects.write[p_index].state = OVERLAP_STATE_EXIT;
+ overlappingObjects[p_index].state = OVERLAP_STATE_EXIT;
}
void AreaBullet::put_overlap_as_inside(int p_index) {
// This check is required to be sure this body was inside
if (OVERLAP_STATE_DIRTY == overlappingObjects[p_index].state) {
- overlappingObjects.write[p_index].state = OVERLAP_STATE_INSIDE;
+ overlappingObjects[p_index].state = OVERLAP_STATE_INSIDE;
}
}