Page 1 of 1

SoftBody: modeling a rope from trimesh

Posted: Thu May 16, 2019 9:14 am
by Dox
Hello,

I'm in trouble with SoftBody :D

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 357 times
Many thanks,

bye

Re: SoftBody: modeling a rope from trimesh

Posted: Thu May 16, 2019 12:20 pm
by steven
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
Collide1.png (60.61 KiB) Viewed 7728 times

Re: SoftBody: modeling a rope from trimesh

Posted: Thu May 16, 2019 3:04 pm
by Dox
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...

Re: SoftBody: modeling a rope from trimesh

Posted: Sun May 19, 2019 8:10 pm
by Dox
... No other idea?

Many thanks, bye

Re: SoftBody: modeling a rope from trimesh

Posted: Mon May 20, 2019 1:53 am
by steven
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.

Re: SoftBody: modeling a rope from trimesh

Posted: Mon May 20, 2019 11:18 am
by Dox
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

Re: SoftBody: modeling a rope from trimesh

Posted: Tue May 21, 2019 11:27 am
by steven
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ļ¼