From d61a3aac7f681bfbe6a6eab97ed2a3473c1099ea Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Sat, 6 Sep 2008 16:48:47 +0000 Subject: [PATCH] Add btCompoundShapes to concave triangle mesh, to QA this report. Couldn't find any issue: http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2557 --- Demos/ConcaveDemo/ConcavePhysicsDemo.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp b/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp index 8e5d9288c..47e1085e8 100644 --- a/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp +++ b/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp @@ -286,14 +286,29 @@ void ConcaveDemo::initPhysics() startTransform.setIdentity(); startTransform.setOrigin(btVector3(0,-2,0)); +#ifdef USE_BOX_SHAPE btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1)); +#else + + btCompoundShape* colShape = new btCompoundShape; + btCollisionShape* cylinderShape = new btCylinderShapeX(btVector3(4,1,1)); + btCollisionShape* boxShape = new btBoxShape(btVector3(4,1,1)); + btTransform localTransform; + localTransform.setIdentity(); + colShape->addChildShape(localTransform,boxShape); + btQuaternion orn(SIMD_HALF_PI,0,0); + localTransform.setRotation(orn); + colShape->addChildShape(localTransform,cylinderShape); + +#endif //USE_BOX_SHAPE + + m_collisionShapes.push_back(colShape); { for (int i=0;i<10;i++) { - //btCollisionShape* colShape = new btCapsuleShape(0.5,2.0);//boxShape = new btSphereShape(1.f); - startTransform.setOrigin(btVector3(2*i,10,1)); + startTransform.setOrigin(btVector3(2,10+i*2,1)); localCreateRigidBody(1, startTransform,colShape); } }