Page 1 of 1

Anchoring softbody to rigid multibody

Posted: Sat Jan 13, 2018 11:05 am
by janci5243
Hi,

I am trying to grasp a softbody with a gripper. It seems like the easiest way to create a stable grasp would be to anchor the softbody to the gripper when a collision is detected and some pressure is applied (I believe I could figure out the details later). However, it seems like softbodies and rigid bodies are using two disjoint constraint systems. There are anchors and joints for softbodies, which can be applied to softbody/softbody and softbody/rigidbody pairs and classic userconstraints applicable for rigidbody/multibody pairs. Is there a way to anchor a softbody to a multibody?

Thanks a lot!

Jan

Re: Anchoring softbody to rigid multibody

Posted: Sun Jan 14, 2018 3:43 pm
by drleviathan
I've never used soft bodies in Bullet, however looking at the btSoftBody API and also at the examples/SoftDemo/SoftDemo.cpp code... it looks like btSoftBody::appendAnchor() is what you want to use.

However I can't find any API for removing an anchor once it has been created! You would have to implement btSoftBody::removeAnchor(), or else derive a custom class (say: DetachableSoftBody) and implement it there.

Re: Anchoring softbody to rigid multibody

Posted: Tue Jan 16, 2018 11:32 am
by janci5243
Thanks drleviathan,

appendAnchor seems to work for anchoring softbody to rigidbody. However, it does not work for multibodies. I found a solution if anyone else is having the same problem - I made a tiny rigidbody that is fixed to multibody by p.createConstraint and then I anchored the softbody to this rigidbody by appendAnchor (this had to be done in c++, no python bindings for this as of now).

Also, in order to create rigidbody through python, you need to call p.createMultiBody with optional parameter useMaximalCoordinates=1(I did not find this obvious, so hopefully it helps someone.