Gah well I went over the demo today, and made sure my 'world setup' was exactly how it is in the softbodies demo. See my world setup below, it should be EXACT...
Code: Select all
//m_collisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration();
mCollisionConfig = new btSoftBodyRigidBodyCollisionConfiguration();
//m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
mDispatcher = new btCollisionDispatcher( mCollisionConfig );
mSoftBodyWorldInfo.m_dispatcher = mDispatcher;
#define maxProxies 8192
btVector3 worldAabbMin( -10000, -10000, -10000 );
btVector3 worldAabbMax( 10000, 10000, 10000 );
//m_broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
mBroadphase = new btAxisSweep3( worldAabbMin, worldAabbMax, maxProxies );
mSoftBodyWorldInfo.m_broadphase = mBroadphase;
//btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver();
mSolver = new btSequentialImpulseConstraintSolver;
//btDiscreteDynamicsWorld* world = new btSoftRigidDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
mWorld = new btSoftRigidDynamicsWorld(
mDispatcher, mBroadphase, mSolver, mCollisionConfig );
//m_dynamicsWorld->getDispatchInfo().m_enableSPU = true;
//m_dynamicsWorld->setGravity(btVector3(0,-10,0));
//m_softBodyWorldInfo.m_gravity.setValue(0,-10,0);
mWorld->getDispatchInfo().m_enableSPU = true;
mWorld->setGravity( btVector3(0,-9.8,0) );
mSoftBodyWorldInfo.m_gravity.setValue(0,-9.8,0);
//m_softBodyWorldInfo.m_sparsesdf.Initialize();
mSoftBodyWorldInfo.m_sparsesdf.Initialize();
Now I create a simple ellipsoid (using the soft body helpers)....
Code: Select all
btSoftBody* body = btSoftBodyHelpers::CreateEllipsoid(mSoftBodyWorldInfo,
btVector3(0,7,0), btVector3(1,1,1)*2.5, 256 );
mWorld->addSoftBody(body);
Every frame I pump my world like so...
The above code should create a 2.5 radius 'squishy sphere' floating 7 units in the air, correct? Well it does (I have my rendering engine set up to visualize the body), the problem is, it falls straight down through the ground (I have a static rigid body box, 4 units thick, and the blob just passes right through it).
Now the strange thing is that there DOES seem to be some collision detection going on between my soft/rigid bodies. If I put some basic rigid body cubes below the blob, the blob WILL knock them out of the way as it falls (but they dont seem to slow the blob down much).
This is driven me nuts
... anyone have any ideas?