Questions about Soft Body Ropes

Leezer
Posts: 22
Joined: Mon Nov 09, 2009 5:06 am

Questions about Soft Body Ropes

Post by Leezer »

More posts, bwahaha! I hope I'm not being too annoying...

I have a couple questions about soft body ropes. Perhaps someone would be willing to help me out. :-)

#1: Rope Thickness
One problem that I'm having pertains to the instability of rope collisions. 2d ropes are so thin that it's easy to trap them inside, say, a moving convex hull shape. You can actually witness this first hand by running the SoftBodyDemo's sticks section. Shoot a cube through the stick field and you'll notice that the sticks will bend in response to the cube, but not enough to prevent them from clipping through the cube. This tendency for the ropes to clip inside other collision shapes (rigid bodies) seems to happen if either (a) a collision shape is coming at the rope really fast (as in the shooting cubes case) or (b) the rope is sitting on top of a triangle mesh collision shape that is slowly rotating (in this case, as soon as a node in the rope slips under a face of the triangle mesh, the rest of it follows suit until it is totally trapped inside the triangle mesh). Is there a way to increase the collision sensitivity of the rope (similar to increasing skin or collision width thickness) so that it is not as thin as far as collision detection goes? Alternately, would it be possible to build a rope out of another kind of soft body (say patches) - i.e. is there a way to link patches together? I will investigate this and see if I can produce a thicker rope this way...

#2: Updating Anchor Points
Another problem that I am having pertains to attaching ropes to a rigid body constructed from a btBvhTriangleMeshShape. To be more precise, I have a couple btBvhTriangleMeshShapes in my scene. They are all consolidated under a single btCompoundShape, which I use to create a rigid body. At each time step, I deform the vertices of each btBvhTriangleMeshShape and call refitTree() for each. Then, I force the btCompoundShape to recognize its child shapes' deformations by calling updateChildTransform(childShape, btTransform::getIdentity()). All goes well until I add ropes to the scene and anchor them to the rigid body created from the btCompoundShape. The individual btBvhTriangleMeshShapes are aware of the vertex deformations, and so is the btCompoundShape. But the rope anchors are completely oblivious to the deformations and stay in place as the compound shape morphs. I want them to stick to the morphing compound shape. It's weird that they aren't aware of the deformations because when I shoot cubes at the deforming compound shape, they bounce off the deformed surface (instead of the original surface) - so newly generated btBoxShapes (rigidBodies) are aware of the vertex deformations - why are the rope anchors not?

Thanks guys,

--Leez
Leezer
Posts: 22
Joined: Mon Nov 09, 2009 5:06 am

Re: Questions about Soft Body Ropes

Post by Leezer »

Okay, initial testing yields that the rope anchors happily update if I move the rigid body around directly (using ->setAngularVelocity(), ->setLinearVelocity(), ->applyForce(), etc)... but I still need them to update if I morph the vertices of the rigid body's collision shape...
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Questions about Soft Body Ropes

Post by Erwin Coumans »

Leezer wrote: #1: Rope Thickness
You might want to try to use tetrahedra to approximate the rope. See Init_TetraBunny for an example, in Bullet/Demos/SoftDemo/SoftDemo.cpp
#2: Updating Anchor Points
Another problem that I am having pertains to attaching ropes to a rigid body constructed from a btBvhTriangleMeshShape.
The child shapes in a btCompoundShape should only be convex shapes or btCompoundShape.

Bullet currently doesn't report an error/assert when you store concave objects inside a btCompoundShape, but a future version might just reject it. It is best to only add convex shapes to a btCompoundShape.

Thanks,
Erwin
Leezer
Posts: 22
Joined: Mon Nov 09, 2009 5:06 am

Re: Questions about Soft Body Ropes

Post by Leezer »

Hmm, thanks for the tip. I also tried anchoring my ropes to a rigid body created from a btBvhTriangleMeshShape.

It seems that the rope anchors are only paying attention to the rigid body's WorldTransform value. Even if individual vertices in the collision shape move, the rigid body won't consider this a transformation. So its WorldTransform value is remaining constant despite the morphing vertices. Thus, the anchors stay where they are.

I'm trying to test out how I can trick the anchors into updating by messing with the rigid body's WorldTransform value manually. But I see that if my rigid body has 0 mass, then ->setWorldTransform() doesn't make it move to the new transform value. I could see why ->setLinearVelocity() or ->setForce() rely on mass, and thus wouldn't move the rigid body, but ->setWorldTransform() manually sets the position and orientation of the rigid body, so why does 0 mass prevent the body from moving? There must be some assertion preventing static collision objects from being moved after they are created...