Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri May 21, 2010 12:41 pm 
Offline

Joined: Fri May 21, 2010 12:11 pm
Posts: 5
I've made some tests on Bullet Cloth. I've added Cloth(triangle mesh) and a Cylinder. The Cloth object tries to collide with it but easily penetrates the primitive cylinder. Here is the video, I used
Code:
psb->generateClusters(0);

here
http://www.youtube.com/watch?v=SOI45ieMsHk
Then I tried to use
Code:
psb->generateClusters(1024);

And the Cloth object seems to not penetrate cylinder, but it constantly receives impulses and cannot go to sleep(always moving):
http://www.youtube.com/watch?v=JXVjMPhYaFk

Here is my code:
Code:
    // adding cloth
    {
        size_t   num_verts = 0;
        size_t   num_faces = 0;
        float *vertexes = NULL;
        int   *faces    = NULL;

        readObjDataDigest("D:\\top2.obj", num_verts, num_faces, faces, vertexes);


        btSoftBody*   psb=btSoftBodyHelpers::CreateFromTriMesh(
            pdemo->m_softBodyWorldInfo,(btScalar*)vertexes,faces,num_faces);
        btSoftBody::Material* pm=psb->appendMaterial();
        pm->m_kLST      =   0.4;
        pm->m_flags      -=   btSoftBody::fMaterial::DebugDraw;
        psb->m_cfg.kDF   =   1;
        psb->m_cfg.kSRHR_CL      =   1;
        psb->m_cfg.kSR_SPLT_CL   =   0;
        psb->m_cfg.collisions   =   btSoftBody::fCollision::CL_SS+

            btSoftBody::fCollision::CL_RS;
        psb->generateBendingConstraints(2,pm);

        psb->getCollisionShape()->setMargin(0.05);
        psb->setTotalMass(0.5);

        ///pass zero in generateClusters to create  cluster for each tetrahedron or triangle
        psb->generateClusters(1024);
        //psb->generateClusters(64);

        pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
    }

    // adding cylinder here
    {
        btCompoundShape* cylinderCompound = new btCompoundShape;
        btCollisionShape* cylinderShape = new btCylinderShape (btVector3(0.5,10,CUBE_HALF_EXTENTS));
        btTransform localTransform;
        localTransform.setIdentity();
        //localTransform.setOrigin(btVector3(0,-10,0));
        cylinderCompound->addChildShape(localTransform,cylinderShape);
        btQuaternion orn(btVector3(0,1,0),SIMD_PI);
        localTransform.setRotation(orn);
        cylinderCompound->addChildShape(localTransform,cylinderShape);

        //m_dynamicsWorld->addRigidBody(cylinderCompound);
        btTransform startTransform;
        startTransform.setIdentity();
        startTransform.setOrigin(btVector3(0,7.5,0));
        btQuaternion rotation;
        rotation.setRotation(btVector3(0,0,1), 1.57);
        startTransform.setRotation(rotation);
        btRigidBody *m_manBody = pdemo->localCreateRigidBody(0, startTransform, cylinderCompound);
    }

I've played with lots of parameters, used different polygonality level but it still penetrates this cylinder(I am using generateClusters(0);). How do I make this cloth to hang on the cylinder?


Top
 Profile  
 
PostPosted: Wed Jun 02, 2010 6:22 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
There are probably some bugs in the cloth/rigid body interaction.

Could you create a small test project (including the .obj file) and file an issue in the tracker, so we can try to fix it in the future?
http://code.google.com/p/bullet/issues/list

Thanks a lot,
Erwin


Top
 Profile  
 
PostPosted: Sun Jul 11, 2010 9:54 am 
Offline

Joined: Fri May 21, 2010 12:11 pm
Posts: 5
I've made my Cloth object more simple and set FIXED_STEP simulation
Code:
#define FIXED_STEP
#ifdef FIXED_STEP
        dt=1.0f/160.f;
      m_dynamicsWorld->stepSimulation(dt,20, dt);

#else
//..
#endif

This helped and Cloth do not penetrate objects so easily, but this killed realtime


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: Bing [Bot], Google [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