Soft Body Physics

I was very impressed by Walaber Entertainment’s Physics of JellyCar: Soft Body Physics Explained video. It really breaks down the components that go into making soft body physics work in games.

So, I decided to implement it in Where Dark Things Sleep. I’ve been busy adding lots of mostly-decorative “stuff” that might be found in a medieval-ish fantasy town/castle/world. Crates, barrels, Cheval de Frise, archery targets, sacks of grain/rice/etc. All but the last are solid bodies, and the sacks just didn’t feel right when being pushed around as solid physics rectangles.

Rebuilding them with soft body physics lets the sacks deform and bend around other structures and slowly regain some of their original shape when left long enough.

I added a threshold of about 7 pixels below which the springs won’t react, so sacks won’t react to minor deformation and which leaves them in more interesting shapes. And I also tweaked the spring formula from F = -kx to F = -kx² because it just seemed to feel a little better for this specific use case.

Previous
Previous

Cliffs

Next
Next

Drawbridges