Create a Softbody
A Softbody is squishy body created from an image. This tutorial is also available in the GitHub repo as a sample samples/softbody2d/create-a-softbody.
Create a new SoftBody2D node
Create a new 2D Scene in Godot. In the newly created scene go to the Scene tab create a new SoftBody2D node by right clicking on the root node and selecting Add child node.
In the resulting window select the SoftBody2D node and select Create:
In case you don't see the node, you probably forgot to activate the addon.
Setting a texture
Next, you need to set a Texture on the node. For this, click on the Scene tab on the left and select our newly created node (usually after creating the node it is already selected):
Next, on the Inspector tab, go to the Polygon2D section, expand the Texture property group and go to the Texture property (where it says Texture <empty>
)
When you click the Texture dropdown, select Quick Load and then select addons/softbody2d/softbody2d.svg
:
You should now see in the 2D scene view the following:
In the Scene tab you can minimise the children of the SoftBody2D node by clicking the arrow button next to the node:
Create a World Boundary
Next we need a ground so the softbody hits something and doesn't fall forever.
Create a StaticBody2D as child of the Root Node:
Then, create a child of this node (select the StaticBody2D node and click Add Child Node) of type CollisionShape2D:
Next, select the node and in the Inspector change the Shape property to New World Boundary Shape2D:
Next, in the 2D scene view move the StaticBody2D down. Select the StaticBody2D node in the Scene tab and select Move Mode:
Next, move the StaticBody2D node below the softbody by dragging it down:
Try it out
Click the Run Current Scene button:
In case you are asked to save the scene, select Save.
If you did everything right, you will see the following: