SoftBodyTuning
How soft a body is. The compliances say how far each kind of constraint gives per unit of force (0 is rigid): the ring's edges, the spokes from the ring to the core, and the area. Soft spokes let a body stretch and squash, a soft area lets it sag and be squeezed, and stiff edges keep the skin from tearing. How fast it moves, how damped and how often it is solved is the world's PhysicsConfig. Pass the values by name.
Two tunings are equal when every value is. toString gives every value, as SoftBodyTuning(edgeCompliance=2.0E-5, spokeCompliance=5.0E-4, areaCompliance=4.0E-4).
Throws
if a compliance is negative or not finite.
Samples
// Softer spokes and area than the default: it squashes and sags more.
val jelly = SoftBodyTuning(spokeCompliance = 0.002f, areaCompliance = 0.002f)
val world = PhysicsWorld()
// A floor of 16-unit tiles along row 9, its top at y = 144.
val grid = SolidGrid(columns = 20, rows = 10, tileSize = 16f)
for (column in 0 until 20) grid.fill(column, 9)
world.solids = grid
val blob = world.softBody(SoftBodyShape.circle(12f, 16, coreMass = 4f), centerX = 160f, baseY = 140f, tuning = jelly)
assertPrints(world.softBodies.tuningOf(blob) == jelly, "true")Properties
How far the area gives: larger lets the body sag and be squeezed.
How far the ring's edges give per unit of force: small, so the skin does not tear.
How far the spokes from the ring to the core give: larger lets the body stretch and squash.