
Jet
IS THERE ANYBODY KNOWS ABOUT IT?zjl19870808 wrote:Hello, everyone! When the rigidbody collides with a softbody, it often penetrate the softbody, which isn't expected to happen in BULLET! so how can I avoid it? Thank you!
Jet
Hi, Thank you very much for your reply. The softbody looks like a rigidbody can be received, so can you tell me some more infomation? Thank you!fishboy82 wrote:Use Cluster can avoid this problem but this will make the soft body looks like more rigid.....
Hi, Thank you again, I tryed this method by addingfishboy82 wrote:Yes ,because Bullet only test softbody's vertex with rigid body for collision detection. So it will be easy for a rigid body's corner to penetrate to a softbody's face. Even worth the rigid body with small size will pass through a soft body's face. But when use Cluster ,bullet will treate the sofrbody like a lot of piece of rigid body's so in this case the collision detection is performed like rigid-rigid body thus will not penetrate
Code: Select all
//psb stand for the soft body
psb->generateClusters(300);
fishboy82 wrote:Hi: you should config the collision algo like this:
psb->m_cfg.collisions = btSoftBody::fCollision::CL_SS+
btSoftBody::fCollision::CL_RS;
You can take bullet's softbody demo for a reference
Code: Select all
setPedMash();//this function set the shape of my softbody, it's a round track, like a torus
btSoftBody* psb=btSoftBodyHelpers::CreateFromTriMesh(pdemo->m_softBodyWorldInfo,PedgVertices,&PedgIndices[0][0],PED_NUM_TRIANGLES);
btSoftBody* psb2=btSoftBodyHelpers::CreateFromTriMesh(pdemo->m_softBodyWorldInfo,PedgVertices,&PedgIndices[0][0],PED_NUM_TRIANGLES);//pdemo is an object of softdemo.
btSoftBody::Material* pm=psb->appendMaterial();
btVector3 x(-10,2,0);
btVector3 x2(10,2,0);
btVector3 a(SIMD_PI,0,SIMD_HALF_PI);
btVector3 s(5.0,5.0,5.0);
pm->m_kLST = 1.0;
pm->m_flags -= btSoftBody::fMaterial::DebugDraw;
psb->generateBendingConstraints(0.2,pm);
psb2->generateBendingConstraints(0.2,pm);
psb->m_cfg.piterations = 20;
psb2->m_cfg.piterations = 20;
psb->generateClusters(30e7);
psb2->generateClusters(30e7);
psb->m_cfg.collisions = btSoftBody::fCollision::CL_SS+
btSoftBody::fCollision::CL_RS;
psb2->m_cfg.collisions = btSoftBody::fCollision::CL_SS+
btSoftBody::fCollision::CL_RS;
psb->scale(s);
psb2->scale(s);
psb->rotate(btQuaternion(a[0],a[1],a[2]));
psb2->rotate(btQuaternion(a[0],a[1],a[2]));
psb->translate(x);
psb2->translate(x2);
psb->setTotalMass(20,true);
psb2->setTotalMass(20,true);
psb->generateClusters(64);
psb2->generateClusters(64);
psb->setFriction(10);
psb2->setFriction(10);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb2);
btSoftBody::LJoint::Specs ls;
ls.erp=0.5f;
/*ls.position=psb->clusterCom(0);*/
ls.position=x;psb->appendLinearJoint(ls,pdemo->m_body);psb->appendLinearJoint(ls,psb2);
/*ls.position=psb2->clusterCom(0);*/
ls.position=x2;psb2->appendLinearJoint(ls,pdemo->m_body);psb2->appendLinearJoint(ls,psb);
btSoftBody::AJoint::Specs aspecs;
aspecs.cfm = 1;
aspecs.erp = 1;
aspecs.axis = btVector3(0,0,1);
psb->appendAngularJoint(aspecs,pdemo->m_body);
psb2->appendAngularJoint(aspecs,pdemo->m_body);
psb->appendAngularJoint(aspecs,psb2);
psb2->appendAngularJoint(aspecs,psb);
.....
Thank you for replying!Garibalde wrote:I cant run your demo seems to crash. However i had similar problems. it seems that if you change the default position and orientation of the rigid body before attaching to the world you will have problems. therefore leave default position and orientation of the rigidbody add it to the world. Then use setworldtransform to change the position and orientation. This seems to have fixed them problem for me.
Hope this helps.
Garibalde
Thank you for replying. I tryed and found it worked a little . So I changed a another method which realizes the softbodies using rigidbodies by a lot constranits, fortunately it worked well.Garibalde wrote:If you create multiple bodies in the same position. This is a problem.. Create a rigid body at default and move it before startin the simulation. The reason that all the bodies go flying off is that once you start running the overlapping bodies all have force acting on them from their respective penetrations.. BOOM!!
I was suggesting is create a rigid body with default.. and add to the world then set the transform to the desired location. Start with 2 bodies.. at a predetermined distance apart at first.. see if that works for you.
if you get rigid to rigid collison working then add the soft body. same as above (change one of the rigid bodies to a soft one).
Hope this helps.
Garibalde