Soft Body Cloth Simulation Stretching Problem
Posted: Sat Aug 29, 2020 1:23 pm
I have a simple flat mesh made up of many triangles to simulate a curtain. Each vertex is a node. I am able to set up physics and it behaves as you would expect for the most part. When ran, it collapses and appears to be cloth (for the most part).
When I take the top row of vertices and set their mass to 0.0f they do not move as one would expect. However, the rest of the vertices in the mesh continue to fall, stretching the curtain.
Do I need to link each node of the curtain to each other so the nodes don't continue to fall?
(Parts of the code below is cut and pasted from various sources as I was looking for any combination that could possibly work.)
Here is an example of what I mean:
When I take the top row of vertices and set their mass to 0.0f they do not move as one would expect. However, the rest of the vertices in the mesh continue to fall, stretching the curtain.
Do I need to link each node of the curtain to each other so the nodes don't continue to fall?
(Parts of the code below is cut and pasted from various sources as I was looking for any combination that could possibly work.)
Code: Select all
btSoftBody * psb = btSoftBodyHelpers::CreateFromTriMesh(*worldInfo,&fVerts[0],&iMeshIndices[0],msh->iFaceCount);
btSoftBody::Material* pm = psb->appendMaterial();
psb->m_cfg.kDP = 0.0;
psb->m_cfg.kDF = 0.0;
psb->m_cfg.kMT = 0.0;
psb->m_cfg.kCHR = 0.0;
psb->m_cfg.kKHR = 0.0;
psb->m_cfg.kSHR = 0.0;
psb->m_cfg.collisions = btSoftBody::fCollision::SDF_RS + btSoftBody::fCollision::CL_SS + btSoftBody::fCollision::CL_SELF;
psb->m_cfg.piterations = 1;
psb->m_materials[0]->m_kLST = 0.1;
psb->m_materials[0]->m_kAST = 0.1;
psb->m_materials[0]->m_kVST = 0.1;
psb->setPose(true, true);
psb->generateBendingConstraints(2);
psb->randomizeConstraints();
psb->getCollisionShape()->setMargin(0.5);
((btSoftRigidDynamicsWorld*)world)->addSoftBody(psb);