How to achieve correct collision between softbody and staticbody ?
I can’t find the right settings to avoid the softbody going thru a staticbody with collision shape. The documentation is a bit light on this subject.
Any recommendation ?

godot-softclip-collision.zip
2MB

    totoetlititi Is this godot 3 or 4?
    softbody is buggy with godot physics, at least in godot 4. The Jolt devs are going to implement softbodies in their next release so that could be a solution (installing godot jolt after the next release).

    totoetlititi you can thinker around with collision boxes and physics settings to see if it gets fixed, there's very little documentation on this so the only thing you can do is play around with the settings and see what changes.
    As far as I know there are no alternatives other than writing the physics simulation yourself or waiting for jolt. Or maybe someone will have an addon.
    Cloth physics work best with attachments, because they sort of stop it from going too far. Which is why they are used with cloaks, nets, flags and courtains.

    An alternative would be to create a mesh with a skeleton and use rigidbodies on the bones, like a ragdoll. This will have better stability, but I again recommend using jolt as it prevents the chains from breaking.

    totoetlititi Is there a current alternative to simulate cloth or textile in Godot 4 ?

    With different physics, I got worse.

    The links here are badly broken.

    I tried the last commit of Jolt. Collisions work !
    But... not exactly as I expect:

      totoetlititi are you using box colliders or a mesh collider?
      Mesh colliders tend to fail when it comes to precision collisions, boxes and spheres are more stable.
      Also you have to create your meshes in blender. The default godot meshes are not good for triangle collision. For example, the sphere has loose edges.

      You could also try changing values like stiffness.
      And you have to setup collision layers. Softbody should be able to collide with the sphere but not affect it's physics, otherwise you get collision-fighting.

      Ok so I tested it myself, WITH collision-fighting, default godot meshes and all forms of stiffness. Godot Jolt is AMAZING.


      I can't overstate how good this addon is.

      I also downloaded your file, it's a bit of a mess, but I didn't find anything wrong with it, other than the plane has too few subdivisions. In my test I used 15x15 and 31x31 subdivisions, I started to notice slowdown at 63x63 subdivisions. Planes have sharp edges, they need to have higher polycount than other shapes like spheres and cubes because otherwise they origami themselves like in your example or are just not worth it.

        Jesusemora I'm sorry, forget everything I said. turns out I forgot to change the physics engine from Godot3D to Jolt.
        Those screenshots are with GodotPhysics. Jolt doesn't have softbody support yet.
        It's funny, I underestimated the godot physics engine but it was working fine all along.

        But I went back to your file and found the source of the problem after cleaning up the mess.

        You should NOT change the scale of a node that is the parent of PHYSICS OBJECTS, the engine gives you a warning, which we all missed.

        scale should always be set to 1 1 1, you instead have to change the size of the colliders from the collider shape.

        How do you work with these "limitations"?

        1 - have ONE static physics node with several colliders as children. put the walls, floors, etc inside it. there's no reason to have so many nodes that do the exact same thing. Only create more static physics objects when they need to have different physics properties, like one for the floors, one for the walls, and for each physics object that has to move, like a platform.
        2 - CSGs have a ENABLE COLLISION option. only use these for prototyping, but you can change their size.
        3 - you were using CSGs where you should've been using simple meshInstance3Ds. this is how godot works, physics is separate from visuals. use meshInstance3Ds for visual, have a ghostly Static physics object with all the colliders on the other side. only combine the two for objects that must move, like characters and rigidbodies. softbody is the only exception to this rule.

        Many thanks for all your advice !
        (You are a bit harsh on the messy aspect of my project....!!! hahah, I'm here to learn, I'll take any advice to improve!)
        Using a single static body for the ground and walls, and changing all CSG by MeshInstance3D works far better (still with the original Godot physic engine).
        But I still have some strange behavior, where the softbody slowly goes thru the walls.
        I wonder what I'm doing wrong.
        Increasing subdivision of the collisionshape ? But where ?

        test-cloth-with-softbody-v2.zip
        2MB

          totoetlititi I tested the file.
          It's a problem with the physics. It was difficult to replicate the bug, but once I did the exact thing happened, the cloth goes through the wall no matter what.
          The problem happens because of the collision between the sphere and the cloth, causing the cloth to build up energy and go through the wall. after enough cloth has gone through the wall the engine considers the center of mass to be on the other side and the cloth leaks through the wall.

          setting the cloth to a different layer helped reduce the possibility of this bug, but it continued to happen every once in a while.

          after more testing, the bug appears to happen when the cloth is folded in half or forced into a small area.

          the problem only happens when the cloth is forced into a corner, increasing the size of colliders doesn't fix it.

          I guess we are back to waiting for Jolt.

            Jesusemora
            I found a mistake. The SoftBody3D Total Mass has to be > 0. With a value of 1, it works as expected:

            But with the March 25th commit of Jolt, it works perfeclty !

              totoetlititi just wondering how you got Godot-Jolt to work with the softbody update? I've given it a go but the latest release is from January, did you have to create a local build to use the latest commit?

                2 months later