Make btSoftBody more hard/rigid

Post Reply
Petwoip
Posts: 5
Joined: Sun Jan 15, 2012 10:53 pm

Make btSoftBody more hard/rigid

Post by Petwoip » Fri May 04, 2012 6:18 pm

Hi, I'm trying to dynamically control the hardness/stiffness/rigidness of a btSoftBody.

The desired effect: When my soft body falls onto a cube and I click a button to harden, the soft body should become stiff and retain the imprint from the cube (it should not expand back to its original shape).

I found one solution that works for making the soft body harder, but I can't go back to making it soft again:

Code: Select all

btSoftBody::Material* material = softBody->appendMaterial();
softBody->generateBendingConstraints(10,material);
softBody->m_cfg.piterations = 20;
generateBendingConstraints successfully makes the object more stiff, but it's an irreversible action. It adds a bunch of new links to the soft body, and manually removing links is not a good option to me (I tried doing this, but was unsuccessful).

Is there another parameter i can use to control the soft body stiffness? I've tried m_cfg.kCHR, m_cfg.kKHR, m_cfg.kSRHR_CL, m_cfg.kSKHR_CL, m_cfg.kSSHR_CL, m_cfg.kVC, m_cfg.kPR. None of them make much difference.

Here is the code I am using to generate the soft body:

Code: Select all

btSoftBody* softBody = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,vertices,this->attachedMesh->getElements(),numTriangles);
btSoftBody::Material* material = softBody->appendMaterial();
softBody->generateBendingConstraints(2,material);
softBody->m_cfg.piterations = 4;
softBody->m_cfg.kDF = .5;
softBody->m_cfg.collisions |= btSoftBody::fCollision::VF_SS;
softBody->randomizeConstraints();
softBody->setTotalMass(mass,true);

Loic
Posts: 2
Joined: Sat Mar 31, 2012 5:07 pm

Re: Make btSoftBody more hard/rigid

Post by Loic » Fri May 11, 2012 2:09 pm

Hi,

Maybe a solution could be to use setPose(false,true), or eventually setPose(true,true). But i never try it.

For more informations about setPose have a look at http://bulletphysics.org/Bullet/phpBB3/ ... 280#p24280

User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Make btSoftBody more hard/rigid

Post by jarno » Sat May 12, 2012 6:45 am

You could remove the bending links by iterating over all the links and looking for those that have the m_bbending value set. Or freeze them by modifying the linear stiffness of the bending link material to 1 and setting the rest length of the links to the current distance between the nodes, and unfreezing them by setting the material linear stiffness to 0.

---JvdL---

Post Reply