Anchoring softbody to rigid multibody

Post Reply
janci5243
Posts: 7
Joined: Sat Jan 06, 2018 4:44 pm

Anchoring softbody to rigid multibody

Post 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
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Anchoring softbody to rigid multibody

Post 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.
janci5243
Posts: 7
Joined: Sat Jan 06, 2018 4:44 pm

Re: Anchoring softbody to rigid multibody

Post 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.
Post Reply