Material
What a surface is like to touch: how much it grips and how much it bounces. Solids and particles each have one, and a contact mixes the two: grip by the geometric mean, so ice on anything slides, and bounce by the larger, so a rubber ball bounces on a stone floor. Pass the values by name.
Two materials are equal when every value is. toString gives every value, as Material(friction=0.4, staticFriction=0.6, restitution=0.0).
Throws
if friction or staticFriction is negative, or restitution is outside 0..1.
Samples
val bouncy = Material(friction = 0.2f, restitution = 0.8f)
val world = PhysicsWorld()
val ball = world.rigidBody(Shape.circle(8f), x = 0f, y = 0f, material = bouncy)
world.rigidBodies.setMaterial(ball, Material.ICE)
assertPrints(bouncy, "Material(friction=0.2, staticFriction=0.6, restitution=0.8)")Constructors
Properties
How much of its speed into the surface a thing keeps, bouncing back out: 0 stops dead, 1 bounces forever.
Grip at rest: a thing stays put while the force along the surface is under this times the push holding it on. Something rests on a slope while this is over the slope's tangent: 0.58 for 30°.