Sign in to follow this  
MrENGine

[Bullet] SoftBody

Recommended Posts

Hi, all.
I faced the trouble of deformation softbody. The thing is that after collision my object is cut/scattered into pieces.
 
 
    m_softBodyWorldInfo.air_density = (btScalar)0.2;
    
    m_softBodyWorldInfo.water_density	=	0;
    m_softBodyWorldInfo.water_offset		=	0;
    m_softBodyWorldInfo.water_normal		=	btVector3(0,0,0);
    
    m_softBodyWorldInfo.m_gravity = btVector3(0, 0, 0); //_world.world->getGravity();
    m_softBodyWorldInfo.m_dispatcher = _world.dispatcher;
    m_softBodyWorldInfo.m_sparsesdf.Reset();
    m_softBodyWorldInfo.m_broadphase = _world.broadPhase;
    m_softBodyWorldInfo.m_sparsesdf.Initialize();
    m_softBodyWorldInfo.m_maxDisplacement = 0;
    
    staticSoftBoby = new StaticMeshToSoftBodyConverter(&m_softBodyWorldInfo);
    staticSoftBoby->addEntity(_entity.ent);
    psb = staticSoftBoby->createSoftBodyFromTrimesh();
   
    
    btSoftBody::Material*	pm=psb->appendMaterial();
    pm->m_kLST				=	0.9;
    pm->m_kAST				=	0.1;
    pm->m_kVST				=	0.1;
    
    psb->m_cfg.piterations = 5;
    psb->m_cfg.kDF = 0.1;
    psb->m_cfg.kMT   =   0.25f;
    psb->m_cfg.kVC                =   0.5f;
    
    psb->m_cfg.collisions |= btSoftBody::fCollision::VF_SS;
    psb->generateClusters(5);
    
    psb->m_cfg.kSRHR_CL = 0.1;
    psb->m_cfg.kSR_SPLT_CL = 0.1;
    
    psb->randomizeConstraints();
    
    psb->generateBendingConstraints(2);
    psb->getCollisionShape()->setMargin(0.1);
    
    psb->setTotalMass(100,true);

What am I doing wrong? Thanks.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this