diff options
Diffstat (limited to 'modules/bullet/collision_object_bullet.cpp')
-rw-r--r-- | modules/bullet/collision_object_bullet.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 0d456a155a..a3158a15e5 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -80,10 +80,11 @@ btTransform CollisionObjectBullet::ShapeWrapper::get_adjusted_transform() const void CollisionObjectBullet::ShapeWrapper::claim_bt_shape(const btVector3 &body_scale) { if (!bt_shape) { - if (active) + if (active) { bt_shape = shape->create_bt_shape(scale * body_scale); - else + } else { bt_shape = ShapeBullet::create_shape_empty(); + } } } @@ -136,18 +137,21 @@ void CollisionObjectBullet::setupBulletCollisionObject(btCollisionObject *p_coll void CollisionObjectBullet::add_collision_exception(const CollisionObjectBullet *p_ignoreCollisionObject) { exceptions.insert(p_ignoreCollisionObject->get_self()); - if (!bt_collision_object) + if (!bt_collision_object) { return; + } bt_collision_object->setIgnoreCollisionCheck(p_ignoreCollisionObject->bt_collision_object, true); - if (space) + if (space) { space->get_broadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bt_collision_object->getBroadphaseHandle(), space->get_dispatcher()); + } } void CollisionObjectBullet::remove_collision_exception(const CollisionObjectBullet *p_ignoreCollisionObject) { exceptions.erase(p_ignoreCollisionObject->get_self()); bt_collision_object->setIgnoreCollisionCheck(p_ignoreCollisionObject->bt_collision_object, false); - if (space) + if (space) { space->get_broadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bt_collision_object->getBroadphaseHandle(), space->get_dispatcher()); + } } bool CollisionObjectBullet::has_collision_exception(const CollisionObjectBullet *p_otherCollisionObject) const { @@ -249,8 +253,9 @@ btCollisionShape *RigidCollisionObjectBullet::get_bt_shape(int p_index) const { int RigidCollisionObjectBullet::find_shape(ShapeBullet *p_shape) const { const int size = shapes.size(); for (int i = 0; i < size; ++i) { - if (shapes[i].shape == p_shape) + if (shapes[i].shape == p_shape) { return i; + } } return -1; } @@ -280,8 +285,9 @@ void RigidCollisionObjectBullet::remove_all_shapes(bool p_permanentlyFromThisBod internal_shape_destroy(i, p_permanentlyFromThisBody); } shapes.clear(); - if (!p_force_not_reload) + if (!p_force_not_reload) { reload_shapes(); + } } void RigidCollisionObjectBullet::set_shape_transform(int p_index, const Transform &p_transform) { @@ -302,8 +308,9 @@ Transform RigidCollisionObjectBullet::get_shape_transform(int p_index) const { } void RigidCollisionObjectBullet::set_shape_disabled(int p_index, bool p_disabled) { - if (shapes[p_index].active != p_disabled) + if (shapes[p_index].active != p_disabled) { return; + } shapes.write[p_index].active = !p_disabled; shape_changed(p_index); } |