--- src/cardynamics.cpp Mon Jan 19 23:26:36 1970 | |
+++ src/cardynamics.cpp Mon Jan 19 23:26:36 1970 | |
@@ -1791,23 +1791,29 @@ | |
bool CARDYNAMICS::WheelContactCallback( | |
btManifoldPoint& cp, | |
- const btCollisionObject* colObj0, | |
- int partId0, | |
+ const btCollisionObjectWrapper* col0, | |
+ int part0, | |
int index0, | |
- const btCollisionObject* colObj1, | |
- int partId1, | |
+ const btCollisionObjectWrapper* col1, | |
+ int part1, | |
int index1) | |
{ | |
- // cars are fracture bodies, wheel is a cylinder shape | |
- const btCollisionShape* shape = colObj0->getCollisionShape(); | |
- if ((colObj0->getInternalType() & CO_FRACTURE_TYPE) && | |
+#if (BT_BULLET_VERSION < 281) | |
+ const btCollisionObject* obj = col0; | |
+ const btCollisionShape* shape = obj->getCollisionShape(); | |
+ const btCollisionShape* rootshape = obj->getRootCollisionShape(); | |
+#else | |
+ const btCollisionObject* obj = col0->getCollisionObject(); | |
+ const btCollisionShape* shape = col0->getCollisionShape(); | |
+ const btCollisionShape* rootshape = obj->getCollisionShape(); | |
+#endif | |
+ if ((obj->getInternalType() & CO_FRACTURE_TYPE) && | |
(shape->getShapeType() == CYLINDER_SHAPE_PROXYTYPE)) | |
{ | |
- // is contact within contact patch? | |
- const btCompoundShape* car = static_cast<const btCompoundShape*>(colObj0->getRootCollisionShape()); | |
- const btCylinderShapeX* wheel = static_cast<const btCylinderShapeX*>(shape); | |
- btVector3 contactPoint = cp.m_localPointA - car->getChildTransform(cp.m_index0).getOrigin(); | |
- if (-direction::up.dot(contactPoint) > 0.5 * wheel->getRadius()) | |
+ const btCompoundShape* carshape = static_cast<const btCompoundShape*>(rootshape); | |
+ const btCylinderShapeX* wheelshape = static_cast<const btCylinderShapeX*>(shape); | |
+ btVector3 contactPoint = cp.m_localPointA - carshape->getChildTransform(cp.m_index0).getOrigin(); | |
+ if (-direction::up.dot(contactPoint) > 0.5 * wheelshape->getRadius()) | |
{ | |
// break contact (hack) | |
cp.m_normalWorldOnB = btVector3(0, 0, 0); | |
--- src/cardynamics.h Mon Jan 19 23:26:36 1970 | |
+++ src/cardynamics.h Mon Jan 19 23:26:36 1970 | |
@@ -25,6 +25,12 @@ | |
class FractureBody; | |
class PTree; | |
+#if (BT_BULLET_VERSION < 281) | |
+#define btCollisionObjectWrapper btCollisionObject | |
+#else | |
+struct btCollisionObjectWrapper; | |
+#endif | |
+ | |
class CARDYNAMICS : public btActionInterface | |
{ | |
friend class PERFORMANCE_TESTING; | |
@@ -151,11 +157,11 @@ | |
static bool WheelContactCallback( | |
btManifoldPoint& cp, | |
- const btCollisionObject* colObj0, | |
- int partId0, | |
+ const btCollisionObjectWrapper* col0, | |
+ int part0, | |
int index0, | |
- const btCollisionObject* colObj1, | |
- int partId1, | |
+ const btCollisionObjectWrapper* col1, | |
+ int part1, | |
int index1); | |
protected: | |
--- src/dynamicsworld.cpp Mon Jan 19 23:26:36 1970 | |
+++ src/dynamicsworld.cpp Mon Jan 19 23:26:36 1970 | |
@@ -105,7 +105,7 @@ | |
int patch_id = -1; | |
const BEZIER * b = 0; | |
const TRACKSURFACE * s = TRACKSURFACE::None(); | |
- btCollisionObject * c = 0; | |
+ const btCollisionObject * c = 0; | |
MyRayResultCallback ray(origin, p, caster); | |
rayTest(origin, p, ray); | |
@@ -221,6 +221,7 @@ | |
void DynamicsWorld::fractureCallback() | |
{ | |
+#if (BT_BULLET_VERSION < 281) | |
m_activeConnections.resize(0); | |
int numManifolds = getDispatcher()->getNumManifolds(); | |
@@ -268,4 +269,5 @@ | |
btRigidBody* child = body->updateConnection(con_id); | |
if (child) addRigidBody(child); | |
} | |
+#endif | |
} |