Jelly Mesh is a 3D soft-body style physics system for Unity meshes. It allows you to quickly and easily convert static meshes into ones that will bounce, stretch and deform, naturally reacting to physical forces in your game.

User Guide

Jelly Mesh is a easy to use soft body physics system that works with any standard Unity mesh. The plugin generates a set of rigid bodies, linked by spring joints, the movement of which is used to influence the vertices of the mesh, thereby deforming and stretching the mesh as as the bodies react to forces in the world. The code works with both the standard Unity 3D physics system, and also the new 2D physics system introduced in the 4.3 update.

Creating a Jelly Mesh

In Unity, click Gameobject->Create Other->Jelly Mesh. You can now simply select a valid mesh using the Jelly Mesh’s ‘Mesh’ field in the inspector, and it should become visible in the scene view. Make sure you check the appropriate value for 'Use 2D Physics' in the inspector view, hit 'Play', and your Jelly Mesh should be ready to use!


As with any physics simulation involving multiple bodies and joints, Jelly Meshes may become unstable unless correctly configured (generally resulting in the meshes appearing to 'explode' as the rigid bodies fly off in all directions!). If your Jelly Meshes do become unstable, you can take the following steps to try to stabilize them:

- Reduce the number of rigid bodies involved in the simulation. For sphere/circle style arrangements, this can be done by reducing the 'Collider Density' value in the inspector.
- Increase the 'Collider Radius' inspector values to make the rigid body colliders larger.
- Reduce the 'Spring Stiffness' value.
- Reduce the per-body Jelly Mesh 'Mass' value and/or the gravity of the game world.
- Try using the 'Attach Neighbours' feature to add additional joints, which should make the overall shape more structurally stable.

Detecting Collisions

Each Jelly Mesh is made up of multiple rigid bodies - when these rigid bodies collide with other bodies/triggers, they will pass messages up to the parent Jelly Sprite using the following functions:

void OnJellyCollisionEnter(JellyMesh.JellyCollision collision)
void OnJellyCollisionExit(JellyMesh.JellyCollision collision)
void OnJellyCollisionStay(JellyMesh.JellyCollision collision)

void OnJellyCollisionEnter2D(JellyMesh.JellyCollision2D collision)
void OnJellyCollisionExit2D(JellyMesh.JellyCollision2D collision
void OnJellyCollisionStay2D(JellyMesh.JellyCollision2D collision)

void OnJellyTriggerEnter(JellyMesh.JellyCollider trigger)
void OnJellyTriggerExit(JellyMesh.JellyCollider trigger)
void OnJellyTriggerStay(JellyMesh.JellyCollider trigger)

void OnJellyTriggerEnter2D(JellyMesh.JellyCollider2D trigger)    void OnJellyTriggerExit2D(JellyMesh.JellyCollider2D trigger)    void OnJellyTriggerStay2D(JellyMesh.JellyCollider2D trigger)

These work almost identically to the standard Unity collision functions - simply implement one or more of them in any script attached to the Jelly Mesh GameObject, and they will get called whenever one of the child rigid bodies receives a collision/trigger message. The JellyCollision/JellyCollider objects that are passed as arguments contain both the original collision data, plus details on exactly which child rigid body reported the collision.

Inspector Settings

The mesh to render

Use 2D Physics
Controls whether the mesh will use the Unity 2D or 3D physics system.

Attach Neighbors
By default, each Jelly Mesh rigid body is connected to the central rigid body only. Choosing the 'Attach Neighbors' option will also connect each body to its nearest neighbor, resulting in a stiffer, more stable Jelly Mesh.

Body Configuration
Changing the body configuration controls the physical layout of the Jelly Mesh rigid bodies and colliders. Some shapes may be more appropriate to certain meshs – for instance, you would generally want to use the circle configuration for a circular mesh in order for it to behave in a natural looking way. It is worth experimenting with the different options to see what works best – some shapes may also be more stable than others depending on your chosen gravity and spring stiffness values. The layout of the individual bodies will be shown in the scene view as green circles.

For each body type, you also have the option of converting to 'Free' mode, which allows you to manually tweak the positions of each body. The suggested workflow is to generate the basic configuration using one of the predefined shapes, then click the 'Copy Configuration To Free Mode' button, which will enable custom editing. Once in Free mode, you can alter body positions and radii in the scene view by clicking and dragging the individual bodies, and alter these values in the Jelly Mesh inspector window. The inspector also allows you to add and delete points.

It is worth nothing that when in free mode, all Jelly Mesh rigid bodies are connected to a central body – this is also true for the triangle, circle and rectangle configurations, and therefore 'Free' version of these shapes should behave identically to their fixed counterparts. The 'Grid' layout, however, uses a lattice style spring structure, which is not preserved when switching to Free mode, so the resulting Jelly Mesh'sbehaviour may be altered somewhat.

Collider Radius
This value controsl how large the rigid body colliders are, measured as a fraction of the overall mesh size. Shrinking the colliders can make shapes less stable and may also allow other rigid body object to pass through the Jelly Mesh. This may or may not be desirable depending on your project.

Collider Scale
This value can be used to stretch or shrink the overall shape of the soft body. Use this to tailor the shape to suit your mesh – eg. an elliptical mesh can be better modelled by simply squashing a circular configuration.

Lock Rotation
Chooses whether or not the Jelly Mesh should be allowed to rotate around the z-axis.

Kinematic Central Body
Allows the user to set the central point as kinematic, which will prevent it from moving and therefore can be used to prevent the Jelly Mesh from moving, or to suspend it in mid-air.

Mesh Scale
How large the actual rendered mesh is. In order to maintain stability of the soft body, you should scale the mesh using this value rather than using the usual transform scale values.

Control Point Influence
This slider controls how strongly each mesh vertex is influenced by the displacement of the physical bodies. Increasing the value will make the mesh deformation more accurately represent the soft body shape, but may also cause visual artefacts.

Physics Material
The physics material applied to each soft body collider. Use this to control friction or bounciness.

Drag/Angular Drag (3D physics mode only)
Controls the drag values of the colliders. Use this to make objects fall slower when in 3D mode

Gravity Scale (2D physics mode only)
Controls the gravity scale of the colliders. Use this to make objects fall faster or slower when in 3D mode

Spring Stiffness
Controls the stiffness of the spring joints that connect the individual bodies. If you find your mesh is collapsing under its own weight, try increasing the spring stiffness.

Spring Damping
The degree to which spring oscillation is suppressed.

Mass/Mass Type
Sets the mass of the soft body – this can be defined either on a global scale (so the mass of the entire mesh is equal to the mass value) or on a per body scale (so each component body will have this mass, meaning that the total mass will be equal to (Mass x Number of Bodies)

Mesh Vertex Density
Determines how many vertices will make up the visible mesh. Higher values may provide more smoothly deformed meshs, but with an increased performance cost.

Attach Points
Attach points allow you to attach child GameObjects to Jelly Meshs. The position of the child objects will deform correctly as though they were a point on the visible mesh. You can also attach Jelly Meshs to other Jelly Meshs - doing so sets the central rigid body of the child mesh to be Kinematic, so that the child mesh will track the position of the main mesh while still independently reacting to physical forces. You can also add Attach Points at runtime using the AddAttachPoint() function.