My softbodies are created from the btSoftBodyHelpers::CreateFromTriMesh function, but whenever it lands on the ground its torn apart to pieces / flattened.
Perhaps the flags/settings I used are not correct? I use a mix of settings from the Init_Volumne sample and Init_Collide.
I removed the generateBendingConstraints and randomizeConstraints, as well as the generateClusters as it causes unstable performance (slowness, or halt) to the app.
Here's the complete init code:
Code: Select all
btSoftBody* psb= btSoftBodyHelpers::CreateFromTriMesh( m_softBodyWorldInfo, m_pTreeTriMeshData->vertices, m_pTreeTriMeshData->indices, m_pTreeMesh->GetStaticMesh()->GetNumFaces() );
btSoftBody::Material* pm=psb->appendMaterial();
pm->m_kLST = 0.5f;
pm->m_kVST = 0.5f;
pm->m_kAST = 0.5f;
//psb->generateBendingConstraints(1,pm);
psb->m_cfg.piterations = 2;
psb->m_cfg.kDF = 0.5;
psb->m_cfg.collisions|=btSoftBody::fCollision::VF_SS;
//psb->m_cfg.kVC = 20;
//psb->randomizeConstraints();
psb->scale( btVector3(15.f,15.f, 15.f));
psb->translate(btVector3(-10,10,-10));
psb->setTotalMass(10);
psb->setPose(true,false);
//psb->generateClusters(4);