I am currently trying to simulate a wind sock using the latest soft body features.
I made some good progress, I managed to set some fixed points using the setMass(x, 0) method.
However, I can't find out how to apply wind to the wind sock. I have tried using addForce(), however it seems the force is not a constant force, it seems to get attenuated with the time.
Which method should I use to apply a constant wind to my soft body ?
This is the code I use right now, if that helps...
Code: Select all
m_pSoftBody = btSoftBodyHelpers::CreateFromTriMesh(*m_pPhysicWrapper->GetSoftBodyWorldInfo(),
&pVertices[0].x,
m_oShape.m_pBtIndices,
m_oShape.m_nIndicesCount/3);
delete[] pVertices;
for (imInt i = 0; i < m_pSoftBody->m_nodes.size(); ++i)
if (m_pSoftBody->m_nodes[i].m_x.getZ() < 1.3f)
m_pSoftBody->setMass(i, 0);
btSoftBody::Material* pm = m_pSoftBody->appendMaterial();
pm->m_kLST = 0.4;
pm->m_flags -= btSoftBody::fMaterial::DebugDraw;
//m_pSoftBody->m_cfg.piterations = 5;
m_pSoftBody->m_cfg.kDF = 1;//0.5;
m_pSoftBody->m_cfg.kMT = 0.05;
m_pSoftBody->m_cfg.kSRHR_CL = 1;//0.5;
m_pSoftBody->m_cfg.kSR_SPLT_CL = 0;//0.5;
m_pSoftBody->m_cfg.collisions = btSoftBody::fCollision::CL_SS + btSoftBody::fCollision::CL_RS;
m_pSoftBody->generateBendingConstraints(2,pm);
//m_pSoftBody->randomizeConstraints();
//m_pSoftBody->setTotalMass(m_fMass);//, imTRUE);
m_pSoftBody->transform(oTrans);
//m_pSoftBody->setPose(false,true);
m_pSoftBody->generateClusters(64);
PostBodyCreation(); // adding body to world
m_pSoftBody->addForce(btVector3(0.0f, 0.0f, 100.0f));