1
\$\begingroup\$

I am using Matter.js physics in an attempt to create soft bodies. I was able to create a body like this:

matter.js soft body

However I am not sure if this is the "soft body" I want. It is true that this body is not entirely rigid and has that bouncy feel when it collides and gets dragged. I was looking for a body that shares similarities with a gelly. This image might visually help explaining the concept:

wanted-gelly-body

I was wondering how these type of bodies can be made. Is it the same as the as matter.js soft body but with a very specific type of properties? I can only get the body to be kind of rigid-squared and not as moldable and circular as I would like it to be.

I am also interesting in manipulating the physics body with in-game interactions which would increase or decrease the physics body size which leads me once more to the conclusion that the type of body that I want must be quite moldable.

Can matter.js handle this or do I have to change the physics engine? Any solutions to approach this?

NOTE: I am using Phaser.js for some in-game components but matter.js physics for physics manipulation because I believe Phaser integrated Physics can't simulate this type of complex body.

Thanks

EDIT: It is very similar to this https://stackoverflow.com/questions/18298329/box2d-roll-soft-body-ball?rq=1. I just need to do that with a js engine I guess. Is there any?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

Making the softbody part of a physics engine isn't an easy task... Thankfully a few people have already worked really hard to do this.

Among these you can find the Unity plugins "Truss Physics" and "VertExMotion".

And then others like "Jelly Physics". (It's C#, but I believe others have converted it to diferent languages, have fun looking for these :p)

You can find it at this link (in c#): https://github.com/kwanchangnim/Jello-Physics

Then the one I am actually using for my game -which is a sort of extension for Box2D- is called "liquid physics" (also many languages) made by Google.

You can it find here: https://github.com/google/liquidfun/tree/master/liquidfun/Box2D/lfjs

I had your exact same issue, so I hope this helps. (It took a whole day of research to find all of these...)

\$\endgroup\$
1
0
\$\begingroup\$

The first illustration in your question is the exact same technique used by many softbody physics engines.

If you mean liquid physics by saying "Jelly alike", then that's a different subject.

But the thing is, there is no need to "re-discover America". There are tons of plug-and-play softbody libraries out there that you can use.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .