[Question]Manipulating models

Hello everybody.

This is the situation. I pretend to manipulate a model which I need it to be a softbody. The question is, is there any smart way to identify subparts of this model? The point is to identify the proper vertices I need for anchoring. It is not intelligent to test vertex by vertex until I get the vertices I need.

I’m pretty noob coding in this framework, though I’ve achieved some simpler solutions, all kind of problems pop up when I try to use soft bodies, is there any good practices guide for working with this kind of objects from bullet?

Any kind of suggestions are welcome, thanks a lot for your time.

Have a nice day.

The Bullet term for subpart is “node”. I know - it collides with Panda3D’s term node, but I have choosen to stick close to the Bullet API here.

Have you tried to inspect the nodes (BulletsoftBodyNode instances) within a softbody?

for part in self.sb.getNode(): print part.getPos()... part.getArea()... part.isAttached()

Or the straight-forward way:

idx = self.sb.getClosestNodeIndex(Point3(...), local=True/False)

This should provide you directly the required index.

Thanks a lot for your answer. I’ve been working on this idea for some days, your help was useful. After doing what you suggested I achieved to analyze and work with the SoftBody in a better way. I come back to you to ask more questions, thats why I asked if there were any “good practice” guide to work with soft bodies.

First of all, my final model has a lot of polygons, and it causes a huge fps drop when I load that model with the debug mode on. So for my test I created a simpler one in order to test softbody configurations and other functions. My first question is, if it is recomended to have a model with less polygons than the “visual model”.

My second question is that when I try to create 2 softbodies that are in touch, then parts of both models just dissapear. I’ve tried to adjust setSoftContactsHardness and setSoftVsSoftHardness but it doesn’t solve the problem. If you wonder what is this test,the target is to create some kind of soft door, that should open and close. The following screenshots show the result of trying to close this door

Door with distance=1:

Door with distance=0

And finally, As you can see in this image both doors have this ropes I need to anchor. I’m working on the idea of model the cords as part of the doors and anchor them. I know you can create ropes using the bullet library,but you are not allowed to anchor softbodies betwen them. It’s maybe a good idea to create a rigidbody as a nexus between the door and the cord? As soon as I have some time I’ll post the result of testing that in order to help others, if you have anny suggestion they will be welcome :smiley: .

I’m afraid we don’t have any “best practice” tip when it comes to softbodies.

About your first question: yes, it makes sense to have two different models, one high-poly for visualisation, and one low-poly for physics. This makes sense for rigid bodies too: collision detection for triangle soups (arbitrary triangle meshes) is rather fast in modern physics engines. However, it is still a good idea to have two different meshes, one for visualisation, and one for physics. Best example would be the static environment (ground, houses, trees, etc.).

About your second question: I can’t give much advice here, sorry. Our wrappers just expose the native Bullet methods when it comes to these parameters. It might be best to ask for help on the Bullet forums. Describe the effect you want to achieve, and maybe someone can give advice on which softbody configuration to use.

About your final question: Yes, a rigid body in between might be a good idea. Another idea would be to use sb_node.append_linear_joint(…). Linear joints have been added only recently, so you have to use current snapshot builds. See this thread for more information: Bullet appendLinearJoint to attach softbody with rigidbody