w0rm / elm-physics / Physics.Material


type alias Material =
Internal.Material.Protected

Materials allow to control friction and bounciness. You can change materials using Body.withMaterial.

default : Material

All bodies initially use this material, it is defined like this:

default =
    custom { friction = 0.3, bounciness = 0 }

custom : { friction : Basics.Float, bounciness : Basics.Float } -> Material

Creates a custom material, e.g.

slippery =
    custom { friction = 0, bounciness = 0 }

bouncy =
    custom { friction = 0.3, bounciness = 0.9 }

When two materials collide, their properties are averaged and clamped between 0 and 1.