# jarceloelement/godot-softbody2d architecture

> Architecture diagram of the GitHub repository jarceloelement/godot-softbody2d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jarceloelement/godot-softbody2d
- Repository: https://github.com/jarceloelement/godot-softbody2d

## Overview

This is a Godot 4.2 plugin for creating deformable 2D softbodies. Its main workflow turns texture outlines (and optionally a hole outline) into filtered regions, assigns those regions to a Skeleton2D, then creates connected physics bodies that drive the bones and deform the texture. The README also documents breakable and bouncy variants. Source excerpts were unavailable, so paths and relationships below rely on the tree and documented behavior; uncertain internal call wiring is omitted.

Main entry points: [`addons/softbody2d/softbody2d.gd`](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd) (SoftBody2D), [`addons/softbody2d/voronoi2d.gd`](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/voronoi2d.gd) (Region creation), [`addons/softbody2d/softbody2d_rigidbody.gd`](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d_rigidbody.gd) (Rigid bodies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Shape generation"]
  node_softbody["SoftBody2D<br/>[softbody2d.gd]"]
  node_edge["Texture outline<br/>[softbody2d.gd]"]
  node_hole["Hole outline<br/>[softbody2d.gd]"]
  node_regions["Region creation<br/>[voronoi2d.gd]"]
  node_region_filter["Region filtering<br/>[softbody2d.gd]"]
end

subgraph group_rigging["Deformation rig"]
  node_skeleton["Skeleton2D<br/>[softbody2d.gd]"]
  node_bones["Bone weights<br/>[softbody2d.gd]"]
  node_texture_deform["Texture deformation<br/>[softbody2d.gd]"]
end

subgraph group_physics["Physics simulation"]
  node_bodies["Rigid bodies"]
  node_collisions["Collision shapes<br/>[softbody2d.gd]"]
  node_joints["Connecting joints<br/>[softbody2d.gd]"]
  node_bone_drive["Bone positioning<br/>[softbody2d.gd]"]
  node_breakage["Joint breakage<br/>[softbody2d.gd]"]
end

node_user(("Plugin user"))

node_user -->|"creates"| node_softbody
node_softbody -->|"extracts"| node_edge
node_softbody -.->|"optionally extracts"| node_hole
node_edge -->|"defines bounds"| node_regions
node_regions -->|"produces regions"| node_region_filter
node_hole -.->|"cuts regions"| node_region_filter
node_softbody -->|"creates"| node_skeleton
node_region_filter -->|"assigns regions"| node_bones
node_skeleton -->|"contains"| node_bones
node_bones -->|"deforms texture"| node_texture_deform
node_softbody -->|"creates"| node_bodies
node_softbody -->|"creates"| node_collisions
node_softbody -->|"connects bodies"| node_joints
node_bodies -->|"drives bones"| node_bone_drive
node_joints -->|"break when stretched"| node_breakage
node_breakage -->|"updates weights"| node_bones

click node_softbody "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_edge "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_hole "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_regions "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/voronoi2d.gd"
click node_region_filter "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_skeleton "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_bones "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_texture_deform "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_bodies "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d_rigidbody.gd"
click node_collisions "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_joints "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_bone_drive "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"
click node_breakage "https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_softbody,node_edge,node_hole,node_regions,node_region_filter,node_user toneBlue
class node_skeleton,node_bones,node_texture_deform toneAmber
class node_bodies,node_collisions,node_joints,node_bone_drive,node_breakage toneMint
```

## Components

### Shape generation

- [SoftBody2D](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Texture outline](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Hole outline](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Region creation](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/voronoi2d.gd): `addons/softbody2d/voronoi2d.gd`
- [Region filtering](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`

### Deformation rig

- [Skeleton2D](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Bone weights](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Texture deformation](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`

### Physics simulation

- [Rigid bodies](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d_rigidbody.gd): `addons/softbody2d/softbody2d_rigidbody.gd`
- [Collision shapes](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Connecting joints](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Bone positioning](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`
- [Joint breakage](https://github.com/jarceloelement/godot-softbody2d/blob/main/addons/softbody2d/softbody2d.gd): `addons/softbody2d/softbody2d.gd`

### Other components

- **Plugin user**

## Connections

- Plugin user → SoftBody2D: creates
- SoftBody2D → Texture outline: extracts
- SoftBody2D → Hole outline: optionally extracts
- Texture outline → Region creation: defines bounds
- Region creation → Region filtering: produces regions
- Hole outline → Region filtering: cuts regions
- SoftBody2D → Skeleton2D: creates
- Region filtering → Bone weights: assigns regions
- Skeleton2D → Bone weights: contains
- Bone weights → Texture deformation: deforms texture
- SoftBody2D → Rigid bodies: creates
- SoftBody2D → Collision shapes: creates
- SoftBody2D → Connecting joints: connects bodies
- Rigid bodies → Bone positioning: drives bones
- Connecting joints → Joint breakage: break when stretched
- Joint breakage → Bone weights: updates weights
