I'm working with bullet for a couple of weeks now and am starting to use soft bodies in my simulation, or rather trying.
I'm attempting to add 1 soft body to the simulation, but when I call the stepSimulation method, my program crashes.
Here is the code I use to build the soft body:
Code: Select all
btSoftBodyWorldInfo firstSoftBodyWorldInfo;
firstSoftBodyWorldInfo.m_sparsesdf.Initialize();
firstSoftBodyWorldInfo.m_sparsesdf.Reset();
firstSoftBodyWorldInfo.air_density = (btScalar)1.2;
firstSoftBodyWorldInfo.water_density = 0;
firstSoftBodyWorldInfo.water_offset = 0;
firstSoftBodyWorldInfo.water_normal = btVector3(0,0,0);
firstSoftBodyWorldInfo.m_gravity.setValue(0,0,0);
firstSoftBodyWorldInfo.m_broadphase = overlappingPairCache;
btSoftBody* firstSoftBody = btSoftBodyHelpers::CreateEllipsoid(firstSoftBodyWorldInfo,btVector3(0.0,0.0,0),
btVector3(0.5,0.3,0.5)*3,
512);
btTransform softTransform;
softTransform.setIdentity();
softTransform.setOrigin(btVector3(0.0, 0.0, 0.0));
firstSoftBody->transform(softTransform);
firstSoftBody->addForce(btVector3(0.0,0.0,0.0));
firstSoftBody->setTotalMass(50,true);
currentWorld->addSoftBody(firstSoftBody);
Code: Select all
for (unsigned int i=0; i<simulationSteps; i++)
{
currentWorld->stepSimulation(1.f/60.f, 10); //THIS IS WHERE THE CODE FAILS
...
}
I tried looking at the soft body demos but they weren't of any help in this regard