Volume constraints

Volume constraints can be used to simulate some sort of softbody physics, though they are not suitable for very stiff softbodies. Volume constraints are better suited for very soft, blobby bodies like a partially deflated beach ball and, in the case of cloth, they require the cloth mesh to be closed (that is, no holes on it).

Also note that pressure constraints must usually be used together with distance constraints.

A cloth ball using volume constraints.

Pressure constraints try to maintain a certain volume of air inside a mesh. They only have one parameter:

Pressure

Percentage of the original mesh volume that the constraints must strive to maintain. 1 means 100% of the original volume, 0.5 equals 50% of the original volume, and 2 = 200% (overpressure).

You can slowly increase the pressure parameter over time using a simple script to simulate an inflating balloon:

using UnityEngine;
using Obi;

[RequireComponent(typeof(ObiCloth))]
public class Inflator : MonoBehaviour {

	ObiCloth cloth;

	public float inflationSpeed = 0.25f;
	public float maxPressure = 2;

	// Use this for initialization
	void Awake () {
		cloth = GetComponent<ObiCloth>();
	}

	// Update is called once per frame
	void Update () {
		cloth.pressure = Mathf.Min(cloth.pressure + Time.deltaTime * inflationSpeed, maxPressure);
	}
}
			

Using this to inflate a sphere which has been fixed to the ground (initial pressure 0.1):