Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tutorials/physics/img/softbody_cube.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tutorials/physics/img/softbody_cube_menu.png
Binary file not shown.
22 changes: 10 additions & 12 deletions tutorials/physics/soft_body.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ A :ref:`SoftBody3D <class_SoftBody3D>` 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 ``Node3D`` 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.
Create a new scene with a ``Node3D`` node as root. Then, create a ``Softbody3D`` node. Add a ``BoxMesh`` in the ``Mesh`` property of the node in the inspector and increase the subdivision of the mesh for simulation.

.. image:: img/softbody_cube.png
.. image:: img/softbody_cube.webp

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.

.. image:: img/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 SoftBody3D will fly around like a plastic bag under strong wind.

.. 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.
Add a camera and something for it to collide with then play the scene to view the simulation.

.. tip:: To improve the simulation's result, increase the ``Simulation Precision``, this will give significant improvement at the cost of performance.

Expand All @@ -34,9 +32,9 @@ 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>`_ or `the Asset Library <https://godotengine.org/asset-library/asset/125>`_.

Open the ``Player`` scene, add a ``SoftBody`` node and assign a ``PlaneMesh`` to it.
Open the ``Player`` scene, add a ``SoftBody3D`` 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:
Open the ``PlaneMesh`` properties and set the size(x: 0.5 y: 1) then set ``Subdivide Width`` and ``Subdivide Depth`` to 5. Adjust the ``SoftBody3D``'s position. You should end up with something like this:

.. image:: img/softbody_cloak_subdivide.png

Expand All @@ -48,20 +46,20 @@ Add a :ref:`BoneAttachment3D <class_BoneAttachment3D>` node under the skeleton n

.. image:: img/softbody_cloak_bone_attach.png

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

.. image:: img/softbody_cloak_pinned.png

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

.. image:: img/softbody_cloak_pinned_attach.png

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

.. image:: img/softbody_cloak_ignore.png

Play the scene and the cloak should simulate correctly.

.. image:: img/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.
This covers the basic settings of SoftBody3D, experiment with the parameters to achieve the effect you are aiming for when making your game.