Cloth and arbitrary objects collisions

frontiervision
Posts: 5
Joined: Sun Aug 02, 2009 10:39 pm

Cloth and arbitrary objects collisions

Post by frontiervision »

Hi,

i am relatively new (lets say *really* new) to Bullet physics. I need to do the following thing. Suppose that i have a "cloth", like the one used in one of the demos of the bullet physics.
I need to put a static object on the "ground" (like a cylinder, a sphere, a teapot and so on) and let a cloth to fall on it.
The cloth should change its shape in accordance with the type of the object it fall on...Is this possible?
How can i texture the cloth?

I have seen the cloth demo and it seems to me that this is possible to do, but i need a clear answer before starting to do this (sorry if this
question may sound really silly...).

I was thinking that i need to add to the dynamic world a cloth, a btCollisionObject with a shape type appropriate (wich? a box for a box, a cylinder for a cylinder and a TRIANGLE_SHAPE_PROXYTYP for a teapot???). I put it on the ground, let the cloth fall, and the bullet physics will simulate cloth/object collision...Is this all too simple?!? Am i dreaming?!?!


Thank you,
Luca
frontiervision
Posts: 5
Joined: Sun Aug 02, 2009 10:39 pm

Re: Cloth and arbitrary objects collisions

Post by frontiervision »

Hi,

i have finally rendered a 3D model with the Bullet physics engine. The problem now is the 3D model / cloth collision. The cloth fall on the 3D model and pass through it. It seems to me that there is some sort of object/cloth collision detection, because the cloth change its shape according to the shape of the 3D model, but even so it pass through it. I have tried to lower the mass of the cloth, but it does not change anything...

Any idea?

Thank,
Luca
frontiervision
Posts: 5
Joined: Sun Aug 02, 2009 10:39 pm

Re: Cloth and arbitrary objects collisions

Post by frontiervision »

Nobody knows any solutions?!?!
You can see what is happening here : http://img90.imageshack.us/img90/963/clothproblem2.jpg

The green cloth fall on the gray object, but it pass through it.. I am using the softbody demo source code.
I would like to avoid this :shock:

I create the rigid mesh (the gray object) in this way:

int numt, numv;
numt = sizeof(objFacedata)/sizeof(int);
numv = sizeof(objVertexdata)/sizeof(float);
btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(numt/3,
(int *)objFacedata,
3*sizeof(int),
numv/3,
(btScalar*) objVertexdata,
3*sizeof(float));

// This is the shape of the object used for collision detection
btGImpactMeshShape *trimesh = new btGImpactMeshShape( indexVertexArrays );
trimesh->setLocalScaling(btVector3(.10f,.10f,.10f));
//trimesh->setMargin(0.07f);
trimesh->updateBound();

Than, i add the rigid body in the world in this way:


btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin(btVector3(0,-5,0));
pdemo->localCreateRigidBody(10, startTransform, trimesh);



Maybe i need to setup some collision flag for the softbody/rigid body collision?
The more accurate the collision between the two objects the more happy i will be!!!

Any idea????

Thanks
k8swan
Posts: 1
Joined: Thu Apr 22, 2010 3:24 am

Re: Cloth and arbitrary objects collisions

Post by k8swan »

did you ever solve this? I'm having the same problem : (