From 43b435c8488501d62fb15940eb551db30db3b898 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 21 Nov 2012 21:32:56 +0000 Subject: Accomodate bullet 2.81 API change. --- src/core/physics.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/physics.cc b/src/core/physics.cc index 2c7dd96..b1c8e0f 100644 --- a/src/core/physics.cc +++ b/src/core/physics.cc @@ -21,11 +21,20 @@ namespace core { * see http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Callbacks_and_Triggers */ +#if (BT_BULLET_VERSION < 281) +// bullet 2.80 or older bool bullet_contact_added_callback(btManifoldPoint &cp, const btCollisionObject *body0, int partId0, int index0, const btCollisionObject *body1, int partId1, int index1) { Entity *entity0 = static_cast(body0->getUserPointer()); Entity *entity1 = static_cast(body1->getUserPointer()); - + +#else +// bullet 2.81 or newer +bool bullet_contact_added_callback(btManifoldPoint &cp, const btCollisionObjectWrapper *body0, int partId0, int index0, const btCollisionObjectWrapper *body1, int partId1, int index1) +{ + Entity *entity0 = static_cast(body0->getCollisionObject()->getUserPointer()); + Entity *entity1 = static_cast(body1->getCollisionObject()->getUserPointer()); +#endif assert(entity0 && entity1); // FIXME there should probably be an entity flag indiciating wether or not it has a collision callback @@ -37,7 +46,6 @@ bool bullet_contact_added_callback(btManifoldPoint &cp, const btCollisionObject if ((entity1->type() == Entity::Dynamic) || (entity1->type() == Entity::Controlable)) { static_cast(entity1)->collision(entity0); } - //con_debug << "collision " << entity0->label() << " - " << entity1->label() << std::endl; // the return value should be ignored by bullet. return true; -- cgit v1.2.3