2D softbodies - how do I use them?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameDevDuck

Hello there!
I am new to the Godot game engine and currently I am setting up a player for a 2D platforming game. The player is supposed to have blobby properties and so my plan was to make them a softbody (I am also trying to put a texture on the softbody), however I cannot find a softbody object meant for 2D environments.

Is there something that I am missing, or is there no 2D softbodies in Godot?

(If 2D softbodies are not a thing, is there any sort of workaround?)

Thanks!

:bust_in_silhouette: Reply From: aXu_AP

A way to make a blob softbody is to make bunch rigidbodies in a ring formation and use DampedSpringJoints to join them together. If it loses it’s shape too easily, try adding a central rigidbody with attachments to every other point.
I tried making one from 8 + 1 points by hand, and it works reasonably well, even if coarsely. It was in a following formation:

o-o-o
|\|/|
o-o-o
|/|\|
o-o-o

But I recommend making a script which creates all needed rigidbodies and springs via parameters, otherwise it’ll get quickly out of hand.

Thanks! This is really helpful!

GameDevDuck | 2021-10-26 00:09

Btw, if anyone is looking at this, I wrote a plugin that does this automatically: GitHub - appsinacup/godot-softbody2d: Godot SoftBody2D - Plugin that adds deformable 2D soft body.

If you created this plugin, first of all, thanks!
Second, maybe you could help me out understand the physics a bit cause i used this on a prototype where I had already worked on the physics and noe it’s going wild :sweat_smile:

Sure. Not sure what you mean by physics, what the plugin does is exactly what is said in this thread. It creates rigidbodies and then links them together with joints. Nothing special really.