## SoftBody: modeling a rope from trimesh

Dox
Posts: 24
Joined: Thu Oct 18, 2018 5:16 pm

### SoftBody: modeling a rope from trimesh

Hello,

I'm in trouble with SoftBody

I'm trying to modeling a rope starting from a mesh (please, see the attachment RopeMesh.h). This is a cylinder of 10m, with 32 resolution faces and 8 subdivisions on the length. Then, I'm using this code in order to build the SoftBody:

Code: Select all

``````static void Init_RopeMatch(SoftDemo* pdemo)
{
btSoftBody* psb = btSoftBodyHelpers::CreateFromTriMesh(pdemo->m_softBodyWorldInfo, gVerticesRope,
&gIndicesRope[0][0],
ROPE_NUM_TRIANGLES);
psb->m_materials[0]->m_kLST = 0.0; //Linear stiffness coefficient [0,1]
psb->m_materials[0]->m_kAST = 0;     //Area/Angular stiffness coefficient [0,1]
psb->m_materials[0]->m_kVST = 0;     //Volume stiffness coefficient [0,1]

psb->m_cfg.kMT = 0.5;
psb->m_cfg.piterations = 5;
psb->randomizeConstraints();
psb->scale(btVector3(6, 6, 6));

psb->setTotalMass(1, true);
psb->setMass(0, 0);
psb->setMass(psb->m_nodes.size()-1, 0);

psb->setPose(false, true);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
}
``````

Basically, I can see the cylinder that is anchored on the first and last node, but the cylinder is pretty rigid, do not bend freely on the 8 subdivisions. It's like a "high jump pole".

Using the btSoftBodyHelpers::CreateRope the rope behavior is very good but I need to start from my mesh (the btSoftBodyHelpers::CreateRope is just a line without volume and in any case I need an integration with meshes).

Setting material stiffness coefficients to 0 doesen't help. How I can setup the SoftBody in order to make the cylinder mesh like a falling rope under gravity? Maybe I need to build a different mesh?

Basically, in a rope I don't need to make soft the "circular section" (the cylinder volume do not change) but I need to bend the subdivisions....I don't know if it's possible...

RopeMesh.h
Rope Cylinder
(335.83 KiB) Downloaded 37 times
Many thanks,

bye

steven
Posts: 73
Joined: Mon Nov 05, 2018 8:16 am
Location: China

### Re: SoftBody: modeling a rope from trimesh

after removing the "psb->m_cfg.kMT = 0.5;" it will become the one like below which seems that your mesh is constructed of some separate parts.
Collide1.png (60.61 KiB) Viewed 1367 times

Dox
Posts: 24
Joined: Thu Oct 18, 2018 5:16 pm

### Re: SoftBody: modeling a rope from trimesh

Hello steven,

hummm...maybe the triangles indices array has some wrong triangle? Maybe the caps...I can try to remove them but I think that the main problem can be on other point...maybe this behavior is correct considering the first and last node are fixed in space...

Dox
Posts: 24
Joined: Thu Oct 18, 2018 5:16 pm

### Re: SoftBody: modeling a rope from trimesh

... No other idea?

Many thanks, bye

steven
Posts: 73
Joined: Mon Nov 05, 2018 8:16 am
Location: China

### Re: SoftBody: modeling a rope from trimesh

Could you first change your mesh? i would like to work with you to find the root cause.
i also noted that the first and last note are not located at the end of this rope.

Dox
Posts: 24
Joined: Thu Oct 18, 2018 5:16 pm

### Re: SoftBody: modeling a rope from trimesh

Hello steven,

thanks for your interest.

Ok, I've removed the caps from the mesh which I attach here.

I attach also the original fbx (as .txt, you can rename to .fbx, cable_block_cyl_fix_10m8sez_NoCaps_Tri.fbx) , maybe is useful. I attach the .obj converted also (by OpenSceneGraph processing).

I process the fbx mesh via OpenSceneGraph, maybe someone wrong happens here even if the behavior seems the same to me. The mesh generated seems correct...I've noted me too the last node problem...I'm a little bit confused right now...

Thanks again,

bye
Attachments
cable_block_cyl_fix_10m8sez_NoCaps_Tri.obj.txt
Rename to .obj
(211.95 KiB) Downloaded 30 times
cable_block_cyl_fix_10m8sez_NoCaps_Tri.txt
Rename to .fbx
(162.26 KiB) Downloaded 35 times
RopeMesh.h
(327.93 KiB) Downloaded 33 times

steven
Posts: 73
Joined: Mon Nov 05, 2018 8:16 am
Location: China

### Re: SoftBody: modeling a rope from trimesh

i find that there are duplicated vertex in the array of gVerticesRope, the engine will create a node for each vertex when this array is passed to the btSoftBody(), so there will be more than one node for a same point that is not what we expect.
i think you need to re-design your gVerticesRope/gIndicesRope. good luck！