'Gluing' soft bodies together

STBO
Posts: 1
Joined: Fri Nov 08, 2013 12:47 pm

'Gluing' soft bodies together

Post by STBO »

Hello,

I want to 'glue' a pair of soft bodies together in Bullet such that vertex i on body a is fixed in the same position as vertex j on body b.

I guess this is a bit like the appendAnchor function, but between two soft bodies rather than one soft and one rigid. In the documentation it says:
It is also possible to attach two soft bodies using constraints, see Bullet/Demos/SoftBody.
However, I really can't find any examples of this. The only constraints mentioned in the soft body demos are for rigid bodies.

I found this old question which is similar, but there weren't any replies.

If anyone can please point me in the right direction - or tell me it is not possible - I would be really grateful. I was considering creating small (non-colliding) rigid objects to use like glue between each of the vertices with appendAnchor, but I think this will probably be pretty inefficient.

Thanks for any advice!
ThinCrust
Posts: 4
Joined: Sun Dec 15, 2013 2:24 pm

Re: 'Gluing' soft bodies together

Post by ThinCrust »

Hi,

I guess this depends on what kind of attachment you are looking for.
If you want to keep the attachment dynamic, you can check the mouseFunc to see how they update the position of a face of the body based on the ray that was cast from your mouse's x-y coordinate in SoftDemo.cpp and try to use those principles in your app. I didn't try this myself and don't know what the function does, but it's a start I suppose.

If the attachment is kinematic, and you know for both bodies which nodes you would like to attach and you know where in 3D space they should be, you can set the position (m_x) of the nodes to the same point in 3D space and either leave them there or move/update them by some routine within each frame step.

Let me know if this helps!