Contents

generate(friction:restitution:)

Generates a new material with the given characteristics.

Declaration

@MainActor @preconcurrency static func generate(friction: Float = 0.8, restitution: Float = 0.8) -> PhysicsMaterialResource

Parameters

  • friction:

    The coefficient of friction, in the range [0, infinity).

  • restitution:

    The coefficient of restitution, in the range [0, 1]. Use values at the high end of the range to indicate materials that experience elastic collisions, meaning that objects bounce off each other and kinetic energy is conserved after a collision. Use low values to indicate materials that lose kinetic energy when they collide.

Return Value

A physics material resource.

See Also

Creating a custom material resource