diff options
Diffstat (limited to 'modules/bullet/area_bullet.cpp')
-rw-r--r-- | modules/bullet/area_bullet.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index edbd9565b8..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) { @@ -173,9 +169,9 @@ void AreaBullet::do_reload_body() { void AreaBullet::set_space(SpaceBullet *p_space) { // Clear the old space if there is one + if (space) { clear_overlaps(false); - isScratched = false; // Remove this object form the physics world space->unregister_collision_object(this); @@ -187,10 +183,11 @@ void AreaBullet::set_space(SpaceBullet *p_space) { if (space) { 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); } @@ -204,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; } } |