Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri May 04, 2012 6:18 pm 
Offline

Joined: Sun Jan 15, 2012 10:53 pm
Posts: 5
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:
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:
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);


Top
 Profile  
 
PostPosted: Fri May 11, 2012 2:09 pm 
Offline

Joined: Sat Mar 31, 2012 5:07 pm
Posts: 2
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 viewtopic.php?p=24280#p24280


Top
 Profile  
 
PostPosted: Sat May 12, 2012 6:45 am 
Offline
User avatar

Joined: Tue Mar 16, 2010 1:42 am
Posts: 57
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---


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Exabot [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group