Godot-Silkload cloth simulation solution screenshot 1
G

Publisher

gaoran0623

Godot-Silkload cloth simulation solution

Tools
Cloth Simulation Physics Rigidbody Verlet 3D Skeleton Collision

A bone-driven cloth simulation solution for godot4.4+ 3D games, based on verlet integration algorithm

Godot-Silkload

A bone-driven cloth simulation solution for godot4.4+ 3D games, based on verlet integration algorithm.

Inspired by: GitHub - coffe789/Godot-2D-Cloth-and-Verlet-Physics-Simulator

https://github.com/user-attachments/assets/cf236598-79c5-41be-9f85-1eff565f50d4

How does it work

It is only tested on Godot 4.4, since it's based on SkeletonModifier3D class.

This customized class instances an array of Rigidbody3D, each Rigidbody3D will be created based on the position of the bones that is given to the node. and the Rigidbody3D instances will be processed based on verlet integration algorithm and constrains.

The collision is done by native methods of Rigidbody3D, you need some StaticBody3D to interactive with these Rigidbody3D instances, and make sure they are in the correct collision layer.

Each bone will be looking at "their own" rigidbody3D, the bone will drive the mesh to perform like cloth

Usage

Put the .gd file anywhere in your project, add child to Skeleton3D, and choose "ClothsimModifier"

Concepts

Bone chain

a chain of bones, for example:

bone[0]

  |

bone[1]

  |

bone[2]

  |

bone[3]

You need at least two bones to make a bone chain.

Reason: In Blender, each bone has a "head" and a "tail", in other words, in Blender, each bone has "length". But after Armatures or Skeletons converted into Godot or a lot of other 3D software, each bone has only its own coordinate and transform, but no length. Meanwhile, I need the last second bone to interpolate where the last bone should be pointing at.

You need at least two bone chains to make a "cloth", otherwise it will be only a "belt" or "chain", but it should also work if that's what you expected.

Root bone

The first bone of a bone chain, but you can alway consider, for example:

bone[0] 

#### Node Disabled

For debugging, self explaining

#### Show Collider Indicator

For debugging, visulizing the colliders

#### Collide At Root

Decide if the verlet particle should be able to collide at the root.

Normally the root will NOT be colliding, but who knowsRoot 

#### Bone Name List

If the skeleton has a lot of bones, it's not convinient to select one by one, I'd rather type the names as Strings here. Just create the list of the names of the bone chains

bone[0][0] bone[1][0] bone[2][0] bone[3][0] bone[4][0] ───┐ <--You can decide if first bone should collide | | | | | | | bone[0][1] bone[1][1] bone[2][1] bone[3][1] bone[4][1] | | | | | | | | |These bones will be simulated bone[0][2] bone[1][2] bone[2][2] bone[3][2] bone[4][2] | |
| | | | | | |
bone[0][3] bone[1][3] bone[2][3] bone[3][3] bone[4][3] | | | | | | | | ▼ Collider Size Curve direction bone[0][4] bone[1][4] bone[2][4] bone[3][4] bone[4][4] ───┘ -----------------------trim = 2 (for example)---------------------- | | | | | ───┐ bone[0][5] bone[1][5] bone[2][5] bone[3][5] bone[4][5] |These bones will not be simulated | | | | | | bone[0][6] bone[1][6] bone[2][6] bone[3][6] bone[4][6] ───┘


#### Trim bonechain by

Sometimes you don't want the whole bonechain to be simulated like cloth, in case that you need part of the bone chain to act

#### Collider Shape Radius Base

Note this will be the biggest collider's radius, but you can use the curve to derate along the bone chain

#### Collider Size Curve

Along the bone chain that existing available colliders, set the derating ratio of the colliders size. The trimmed bones will NOT be counted

#### Closed Bone Loop

Simulate a cylinder-like cloth such as skirt: true, or else a piece of cloth, such as flag: false