logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

vdrift-20120722-bullet.patch (3406B)


  1. --- src/cardynamics.cpp Mon Jan 19 23:26:36 1970
  2. +++ src/cardynamics.cpp Mon Jan 19 23:26:36 1970
  3. @@ -1791,23 +1791,29 @@
  4. bool CARDYNAMICS::WheelContactCallback(
  5. btManifoldPoint& cp,
  6. - const btCollisionObject* colObj0,
  7. - int partId0,
  8. + const btCollisionObjectWrapper* col0,
  9. + int part0,
  10. int index0,
  11. - const btCollisionObject* colObj1,
  12. - int partId1,
  13. + const btCollisionObjectWrapper* col1,
  14. + int part1,
  15. int index1)
  16. {
  17. - // cars are fracture bodies, wheel is a cylinder shape
  18. - const btCollisionShape* shape = colObj0->getCollisionShape();
  19. - if ((colObj0->getInternalType() & CO_FRACTURE_TYPE) &&
  20. +#if (BT_BULLET_VERSION < 281)
  21. + const btCollisionObject* obj = col0;
  22. + const btCollisionShape* shape = obj->getCollisionShape();
  23. + const btCollisionShape* rootshape = obj->getRootCollisionShape();
  24. +#else
  25. + const btCollisionObject* obj = col0->getCollisionObject();
  26. + const btCollisionShape* shape = col0->getCollisionShape();
  27. + const btCollisionShape* rootshape = obj->getCollisionShape();
  28. +#endif
  29. + if ((obj->getInternalType() & CO_FRACTURE_TYPE) &&
  30. (shape->getShapeType() == CYLINDER_SHAPE_PROXYTYPE))
  31. {
  32. - // is contact within contact patch?
  33. - const btCompoundShape* car = static_cast<const btCompoundShape*>(colObj0->getRootCollisionShape());
  34. - const btCylinderShapeX* wheel = static_cast<const btCylinderShapeX*>(shape);
  35. - btVector3 contactPoint = cp.m_localPointA - car->getChildTransform(cp.m_index0).getOrigin();
  36. - if (-direction::up.dot(contactPoint) > 0.5 * wheel->getRadius())
  37. + const btCompoundShape* carshape = static_cast<const btCompoundShape*>(rootshape);
  38. + const btCylinderShapeX* wheelshape = static_cast<const btCylinderShapeX*>(shape);
  39. + btVector3 contactPoint = cp.m_localPointA - carshape->getChildTransform(cp.m_index0).getOrigin();
  40. + if (-direction::up.dot(contactPoint) > 0.5 * wheelshape->getRadius())
  41. {
  42. // break contact (hack)
  43. cp.m_normalWorldOnB = btVector3(0, 0, 0);
  44. --- src/cardynamics.h Mon Jan 19 23:26:36 1970
  45. +++ src/cardynamics.h Mon Jan 19 23:26:36 1970
  46. @@ -25,6 +25,12 @@
  47. class FractureBody;
  48. class PTree;
  49. +#if (BT_BULLET_VERSION < 281)
  50. +#define btCollisionObjectWrapper btCollisionObject
  51. +#else
  52. +struct btCollisionObjectWrapper;
  53. +#endif
  54. +
  55. class CARDYNAMICS : public btActionInterface
  56. {
  57. friend class PERFORMANCE_TESTING;
  58. @@ -151,11 +157,11 @@
  59. static bool WheelContactCallback(
  60. btManifoldPoint& cp,
  61. - const btCollisionObject* colObj0,
  62. - int partId0,
  63. + const btCollisionObjectWrapper* col0,
  64. + int part0,
  65. int index0,
  66. - const btCollisionObject* colObj1,
  67. - int partId1,
  68. + const btCollisionObjectWrapper* col1,
  69. + int part1,
  70. int index1);
  71. protected:
  72. --- src/dynamicsworld.cpp Mon Jan 19 23:26:36 1970
  73. +++ src/dynamicsworld.cpp Mon Jan 19 23:26:36 1970
  74. @@ -105,7 +105,7 @@
  75. int patch_id = -1;
  76. const BEZIER * b = 0;
  77. const TRACKSURFACE * s = TRACKSURFACE::None();
  78. - btCollisionObject * c = 0;
  79. + const btCollisionObject * c = 0;
  80. MyRayResultCallback ray(origin, p, caster);
  81. rayTest(origin, p, ray);
  82. @@ -221,6 +221,7 @@
  83. void DynamicsWorld::fractureCallback()
  84. {
  85. +#if (BT_BULLET_VERSION < 281)
  86. m_activeConnections.resize(0);
  87. int numManifolds = getDispatcher()->getNumManifolds();
  88. @@ -268,4 +269,5 @@
  89. btRigidBody* child = body->updateConnection(con_id);
  90. if (child) addRigidBody(child);
  91. }
  92. +#endif
  93. }