btGImpactMeshShape does not collide with soft[FOUND+REMARKS]

XMight
Posts: 32
Joined: Tue Feb 22, 2011 1:00 pm

btGImpactMeshShape does not collide with soft[FOUND+REMARKS]

Post by XMight »

Hello everyone,
I have a problem. I use in my app. btGImpactMeshShape's, and soft bodies. I found that btGImpactMeshShape's do not collide with softBody shapes. However, if I create a bullet shape, for example Cylinder, it collides with the softBody. How can I do btGImpactMeshShape's to collide with soft bodies, anyone?

Thank you!
Last edited by XMight on Wed Apr 27, 2011 1:12 pm, edited 1 time in total.
XMight
Posts: 32
Joined: Tue Feb 22, 2011 1:00 pm

Re: btGImpactMeshShape does not collide with softBody

Post by XMight »

XMight wrote:Hello everyone,
I have a problem. I use in my app. btGImpactMeshShape's, and soft bodies. I found that btGImpactMeshShape's do not collide with softBody shapes. However, if I create a bullet shape, for example Cylinder, it collides with the softBody. How can I do btGImpactMeshShape's to collide with soft bodies, anyone?

Thank you!
I found that there exists an algorithm: btSoftBodyConcaveCollisionAlgorithm that theoretically must do what I need, but I don't know how to use it. It is used by default in SoftBodyRigidBodyCollisionConfiguration or I must register it somehow? Coz there is no such method, like in the case of btGImpact btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);

EDIT: I see that this algorithm is used in btSoftBodyRigidBodyCollisionConfiguration. However, the concave dynamic rigid bodies can pass through the soft bodies, even if they can slightly change the position of the soft body. Is this a configuration issue, or what? How can I change so that rigid bodies not pass the soft ones and inverse?
XMight
Posts: 32
Joined: Tue Feb 22, 2011 1:00 pm

Re: btGImpactMeshShape does not collide with softBody

Post by XMight »

Doing some work of the kind "try and see what you obtain", I found that collision detection of btGImpactMeshShape with a softBody does not work in the case when I register btGImpactCollisionAlgorithm. However, if I use btGImpactMeshShape's without registering the collision algorithm, soft bodies do collide with concave objects correctly, but obviously the collision between btGImpactShapes is very very slow.

Also, the collision happens only if I set the margin to 0.5 (bullet default is 0.04)

Someone can explain why this happens and what can I do about it? Please Admins, or developers of Bullet :)
XMight
Posts: 32
Joined: Tue Feb 22, 2011 1:00 pm

Re: btGImpactMeshShape does not collide with softBody

Post by XMight »

Here is what I discovered during these days of using Bullet. There is the explanation, and some remarks.

There are two ways to do collision between rigidBody and soft body (that I discovered):
1. register only VF_SS, but in such case no btGImpactCollisionAlgorithm must be registered, otherwise no collision between soft and rigid from mesh will be done. Also no clusters must be used. Better simulation. No collision between concave rigid bodies will be present.
2. register CL_SS + CL_RS, generate clusters, and m_kLST = 1.0f (material) must be used. btGImpact collision algorithm can be used, thus all objects will collide. Worse soft body simulation than in the point1, but maybe this is because I used the same parameter values for the softBody configuration and material.

Remarks: 1. Every object in the scene must have the mass set depending on the volume of the object, but how to calculate this for the models that are imported from different model files, I don't know.
2. The value of the force applied to the soft body must be based on the mass of the whole object. Otherwise the simulation may become unstable, objects blow up and disappear.
3. Bullet mixes up my vertex indexes at the creation of the softBody from a trimesh, so if I want to apply a texture on the softBody, it will not be applied correctly. I didn't figure for the moment how to correct this. The only thing I can think about is to create a map, and to map every vertex of the softBody to the original index, but this will cost too mush computation performance.
4. Collision between softBody and other bodies is dependent of the tessellation, so you must find what's the best value for your case.
5. I must use collision margin for the soft bodies and rigid bodies of 0.5; I would like to know the relationship of the collision margin to the simulation stability, since if I leave collision margin = default, my soft bodies blow up.
rookie
Posts: 12
Joined: Mon Dec 05, 2011 8:36 pm

Re: btGImpactMeshShape does not collide with soft[FOUND+REMA

Post by rookie »

@XMight; Did you figure out a way to apply texture correctly?? I am stuck at this. Please help me.