Simulating a Soft Body With SpringConstraints

For a recent project, I have been trying to find a way to simulate a realistic soft body and this post came up.

Obviously, I am not a talented developer in general, so could anyone dumb down this post for me? I tried to create it, as the post says with SpringConstraints, but after reading the documentation, I am still confused about rendering triangles, getting the spring to hold up the parts instead of pulling together and collapsing, etc.

I have also failed to find open-source soft bodies created using springs. Softbodies with multiple parts joined using BallSocketConstraints are simply less smooth and satisfying than the cube created in the post linked.

If anyone knows of any developer resources or is more familiar with physics and SpringConstraints, please elaborate on what I’m doing wrong with the SpringConstraints, or alternate solutions.

(When I followed the instructions of the post, I simply joined all 8 vertices using springs constraints. However, when I tested and unanchored the model, the top snapped to the bottom, so I am confused about how the SpringConstraints in the post were able to stay up straight and support the parts.)

Lastly, probably the one I am the most clueless about is how triangles were rendered with RunService according to the post linked. If anyone knows of an open-sourced script like that or how it is done, please reply.

1 Like

I was literally working on a open source softbody at the time of this topic being made :skull:

How are you filling the object? The post says something about rendering with RunService.

I have parts and a bone inside of a mesh, very part has a designated bone and when RunService.Heartbeat is called, the bones position will match the part and there are springs between parts for physics.

I have realized that the method I initially used to create the soft bodies is not optimal. However, I have made progress during testing and discovered a better approach.

In this new method, I generate the outer surfaces of a cube using parts. Each part is connected to its neighboring parts using either a rope or rod constraint. To create the desired effect, I utilize a VectorForce to apply a force that is directed away from the center of the cube.

While I have achieved positive results with this approach, one challenge I encountered is that the cubes tend to shake violently. I am actively searching for a solution to this issue before I can share my findings.

Let me know if you need any further assistance or have any additional questions!

Also for rendering the triangles, I used EgoMoose’s code to generate a triangle from 3 points. I hard-coded it and it isn’t the best way. With my new approach, I use skinned meshes to create a more natrual effect.

I’ve created a new post on the new method I found. It may have the answer you’re looking for.

https://devforum.roblox.com/t/better-soft-body-physics/2469199

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.