From 5fec62b6fab0c9bebe3bb00edf2a0da7d7743f1e Mon Sep 17 00:00:00 2001 From: deflected Date: Thu, 22 Mar 2018 12:31:41 +0200 Subject: [PATCH] bullet: Corrected possible false check - When a bullet world is created it sets the filter algorithm callback that will use. Later changes to PRC config data should not lead to false assumptions that the bullet world is working with the new config. Signed-off-by: deflected Closes #289 --- panda/src/bullet/bulletWorld.cxx | 7 ++++--- panda/src/bullet/bulletWorld.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index 18c23c8896..9bfa707e9d 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -82,7 +82,8 @@ BulletWorld() { _world->getPairCache()->setInternalGhostPairCallback(&_ghost_cb); // Filter callback - switch (bullet_filter_algorithm) { + _filter_algorithm = bullet_filter_algorithm; + switch (_filter_algorithm) { case FA_mask: _filter_cb = &_filter_cb1; break; @@ -1086,7 +1087,7 @@ void BulletWorld:: set_group_collision_flag(unsigned int group1, unsigned int group2, bool enable) { LightMutexHolder holder(get_global_lock()); - if (bullet_filter_algorithm != FA_groups_mask) { + if (_filter_algorithm != FA_groups_mask) { bullet_cat.warning() << "filter algorithm is not 'groups-mask'" << endl; } @@ -1198,7 +1199,7 @@ set_filter_callback(CallbackObject *obj) { nassertv(obj != NULL); - if (bullet_filter_algorithm != FA_callback) { + if (_filter_algorithm != FA_callback) { bullet_cat.warning() << "filter algorithm is not 'callback'" << endl; } diff --git a/panda/src/bullet/bulletWorld.h b/panda/src/bullet/bulletWorld.h index 36f3723535..35a2c8c634 100644 --- a/panda/src/bullet/bulletWorld.h +++ b/panda/src/bullet/bulletWorld.h @@ -265,6 +265,7 @@ private: btGhostPairCallback _ghost_cb; + FilterAlgorithm _filter_algorithm; btFilterCallback1 _filter_cb1; btFilterCallback2 _filter_cb2; btFilterCallback3 _filter_cb3;