SoftBody

    A node is used for soft body simulations.

    We will create a bouncy cube to demonstrate the setup of a soft body.

    Create a new scene with a node as root. Then, create a Softbody node. Add a CubeMesh in the mesh property of the node in the inspector and increase the subdivision of the mesh for simulation.

    Set the parameters to obtain the type of soft body you aim for. Try to keep the Simulation Precision above 5, otherwise, the soft body may collapse.

    ../../_images/softbody_cube_menu.png

    Note

    Handle some parameters with care, as some value can lead to strange results. For example, if the shape is not completely closed and you set pressure to more than 0, the softbody will fly around like a plastic bag under strong wind.

    Play the scene to view the simulation.

    Tip

    Cloak simulation

    Let’s make a cloak in the Platformer3D demo.

    Note

    You can download the Platformer3D demo on GitHub <https://github.com/godotengine/godot-demo-projects/tree/master/3d/platformer&gt; or .

    Open the Player scene, add a node and assign a PlaneMesh to it.

    Open the PlaneMesh properties and set the size(x: 0.5 y: 1) then set Subdivide Width and Subdivide Depth to 5. Adjust the SoftBody’s position. You should end up with something like this:

    Tip

    Subdivision generates a more tessellated mesh for better simulations.

    Add a BoneAttachment node under the skeleton node and select the Neck bone to attach the cloak to the character skeleton.

    Note

    ../../_images/softbody_cloak_bone_attach.png

    To create pinned joints, select the upper vertices in the node:

    The pinned joints can be find in SoftBody’s Attachments property, choose the BoneAttachment as the SpatialAttachment for each pinned joints, the pinned joints are now attached to the neck.

    ../../_images/softbody_cloak_pinned_attach.png

    Last step is to avoid clipping by adding the Kinematic Body Player to Parent Collision Ignore of the SoftBody.

    Play the scene and the cloak should simulate correctly.

    ../../_images/softbody_cloak_finish.png

    This covers the basic settings of softbody, experiment with the parameters to achieve the effect you are aiming for when making your game.