diff options
author | Andrea Catania <info@andreacatania.com> | 2018-10-06 16:50:10 +0200 |
---|---|---|
committer | Andrea Catania <info@andreacatania.com> | 2018-10-06 16:50:10 +0200 |
commit | 7d681274f8aa2a7a0bac004a16e376d36103c94e (patch) | |
tree | ad0413b543367512419058be5867ddc253e4f2e8 /modules/bullet/area_bullet.cpp | |
parent | 5328dcb7bba61f7727bdf75ec634adab1584a51c (diff) | |
download | redot-engine-7d681274f8aa2a7a0bac004a16e376d36103c94e.tar.gz |
Improved code that handles collision shapes, fixes #21945
Diffstat (limited to 'modules/bullet/area_bullet.cpp')
-rw-r--r-- | modules/bullet/area_bullet.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index a3ba3aa0bf..a0486443c2 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -58,7 +58,7 @@ AreaBullet::AreaBullet() : isScratched(false) { btGhost = bulletnew(btGhostObject); - btGhost->setCollisionShape(BulletPhysicsServer::get_empty_shape()); + reload_shapes(); setupBulletCollisionObject(btGhost); /// Collision objects with a callback still have collision response with dynamic rigid bodies. /// In order to use collision objects as trigger, you have to disable the collision response. @@ -166,11 +166,9 @@ bool AreaBullet::is_monitoring() const { return get_godot_object_flags() & GOF_IS_MONITORING_AREA; } -void AreaBullet::main_shape_resetted() { - if (get_main_shape()) - btGhost->setCollisionShape(get_main_shape()); - else - btGhost->setCollisionShape(BulletPhysicsServer::get_empty_shape()); +void AreaBullet::main_shape_changed() { + CRASH_COND(!get_main_shape()) + btGhost->setCollisionShape(get_main_shape()); } void AreaBullet::reload_body() { |