OgreBullet, soft body

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
ENGine
Goblin
Posts: 266
Joined: Fri Jan 27, 2006 9:13 pm
Location: Belarus
x 2
Contact:

OgreBullet, soft body

Post by ENGine »

Hi, all.

Please, help to solve the following trouble:
I created the Soft Body object:

Code: Select all

m_softBodyWorldInfo.air_density = (btScalar)1.2;
    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();
    
    staticSoftBoby = nil; dynamicSoftBody = nil;
    if (_static) {
        staticSoftBoby = new StaticMeshToSoftBodyConverter(&m_softBodyWorldInfo);
        staticSoftBoby->addEntity(_entity.ent);
        psb = staticSoftBoby->createSoftBodyFromTrimesh();
    } else {
        dynamicSoftBody = new AnimatedMeshToSoftBodyConverter(&m_softBodyWorldInfo);
        dynamicSoftBody->addEntity(_entity.ent);
        psb = dynamicSoftBody->createSoftBodyFromTrimesh();
    }
    
    btSoftBody::Material *pm=psb->appendMaterial();
    pm->m_kLST = 0.1;
    psb->m_cfg.piterations = 2;
    psb->m_cfg.kDF = 0.5;
    psb->m_cfg.collisions |= btSoftBody::fCollision::VF_SS;
    psb->generateClusters(0);
    psb->randomizeConstraints();
    psb->setTotalMass(100,true);
    
    psb->setUserPointer((__bridge void *)_name);
    btSoftRigidDynamicsWorld *softWorld = (btSoftRigidDynamicsWorld *)_world.world;
    softWorld->addSoftBody(psb);

Here is a short result-video: https://www.dropbox.com/s/dg41r9ok67k5g ... y.mov?dl=0
And I can't clear why it's flying. What is wrong? Thanks.

I need that it will be static soft body.
User avatar
ENGine
Goblin
Posts: 266
Joined: Fri Jan 27, 2006 9:13 pm
Location: Belarus
x 2
Contact:

Re: OgreBullet, soft body

Post by ENGine »

It seems to me that: m_softBodyWorldInfo.m_maxDisplacement = 0; has solved my problem.
but after the collision soft object is broken into pieces

default: http://joxi.net/l2ZlkNLI8QQE7r
after collision: http://joxi.net/gmvbWqYfxRRqbm
Post Reply