Advertisement

[Bullet] SoftBody

Started by April 13, 2016 04:39 AM
-1 comments, last by MrENGine 8 years, 5 months ago
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.

This topic is closed to new replies.

Advertisement