- Home /
2D softbody physics with custom spring
I'm trying to make custom 2D softbody physics that can interact with other Unity colliders.
My starting point was to implement a custom spring joint capable of connecting two entities ("particle") together. With these joints and with 4 particles I made a simple rectangle. The 4 particles are created inside a GameObject used as a container, to which I applied the RigidBody2D and PolygonCollider2D components. So the displacement of the particles is relative to the container.
If I apply forces directly to the particles the figure deforms correctly and works quite well, but the problem is that I don't know how to get the forces directly from the collider or the rigid body.
What I would need is to deduce from the collisions the forces to be applied to the particles, and at the same time keep the standard behavior of the collision.
Do you have any suggestions on this?