Don't like ads? PRO users don't see any ads ;-)
Guest

BasicTest_StabilityIssue.patch

By: a guest on Jul 5th, 2012  |  syntax: Diff  |  size: 1.65 KB  |  hits: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --- bullet-2.80-rev2531/Demos/BasicDemo/BasicDemo.cpp   2011-04-08 18:14:22.000000000 +0200
  2. +++ bullet-2.80-rev2531_modified/Demos/BasicDemo/BasicDemo.cpp  2012-07-05 22:10:15.853000003 +0200
  3. @@ -28,6 +28,14 @@
  4.  #define START_POS_Y -5
  5.  #define START_POS_Z -3
  6.  
  7. +#define COIN_DISK_RADIUS  0.6000
  8. +#define COIN_DISK_HEIGHT  0.0200
  9. +#define COIN_BOX_WIDTH    0.1800
  10. +#define COIN_BOX_HEIGHT   0.1800
  11. +#define COIN_BOX_OFFSET   0.3150
  12. +
  13. +
  14. +
  15.  #include "BasicDemo.h"
  16.  #include "GlutStuff.h"
  17.  ///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
  18. @@ -138,7 +146,23 @@
  19.                 //create a few dynamic rigidbodies
  20.                 // Re-using the same collision is better for memory usage and performance
  21.  
  22. -               btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
  23. +
  24. +               btCompoundShape* colShape = new btCompoundShape();
  25. +               btTransform localTrans;
  26. +
  27. +
  28. +               btCollisionShape* bottomShape = new btCylinderShapeZ(btVector3(COIN_DISK_RADIUS, 0, COIN_DISK_HEIGHT/2));
  29. +               btCollisionShape* topShape = new btBoxShape(btVector3(COIN_BOX_WIDTH/2, COIN_BOX_WIDTH/2, COIN_BOX_HEIGHT/2));
  30. +
  31. +               localTrans.setIdentity();
  32. +               localTrans.setOrigin(btVector3(0,0,0));
  33. +               colShape->addChildShape(localTrans,bottomShape);
  34. +
  35. +               localTrans.setIdentity();
  36. +               localTrans.setOrigin(btVector3((COIN_BOX_OFFSET + COIN_BOX_WIDTH/2), 0, -(COIN_DISK_HEIGHT + COIN_BOX_HEIGHT)/2));
  37. +               colShape->addChildShape(localTrans,topShape);
  38. +
  39. +//             btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
  40.                 //btCollisionShape* colShape = new btSphereShape(btScalar(1.));
  41.                 m_collisionShapes.push_back(colShape);