
BasicTest_StabilityIssue.patch
By: a guest on
Jul 5th, 2012 | syntax:
Diff | size: 1.65 KB | hits: 40 | expires: Never
--- bullet-2.80-rev2531/Demos/BasicDemo/BasicDemo.cpp 2011-04-08 18:14:22.000000000 +0200
+++ bullet-2.80-rev2531_modified/Demos/BasicDemo/BasicDemo.cpp 2012-07-05 22:10:15.853000003 +0200
@@ -28,6 +28,14 @@
#define START_POS_Y -5
#define START_POS_Z -3
+#define COIN_DISK_RADIUS 0.6000
+#define COIN_DISK_HEIGHT 0.0200
+#define COIN_BOX_WIDTH 0.1800
+#define COIN_BOX_HEIGHT 0.1800
+#define COIN_BOX_OFFSET 0.3150
+
+
+
#include "BasicDemo.h"
#include "GlutStuff.h"
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
@@ -138,7 +146,23 @@
//create a few dynamic rigidbodies
// Re-using the same collision is better for memory usage and performance
- btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
+
+ btCompoundShape* colShape = new btCompoundShape();
+ btTransform localTrans;
+
+
+ btCollisionShape* bottomShape = new btCylinderShapeZ(btVector3(COIN_DISK_RADIUS, 0, COIN_DISK_HEIGHT/2));
+ btCollisionShape* topShape = new btBoxShape(btVector3(COIN_BOX_WIDTH/2, COIN_BOX_WIDTH/2, COIN_BOX_HEIGHT/2));
+
+ localTrans.setIdentity();
+ localTrans.setOrigin(btVector3(0,0,0));
+ colShape->addChildShape(localTrans,bottomShape);
+
+ localTrans.setIdentity();
+ localTrans.setOrigin(btVector3((COIN_BOX_OFFSET + COIN_BOX_WIDTH/2), 0, -(COIN_DISK_HEIGHT + COIN_BOX_HEIGHT)/2));
+ colShape->addChildShape(localTrans,topShape);
+
+// btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
m_collisionShapes.push_back(colShape);