PhysicsMaterial class Physics

Surface properties (friction, restitution, density) of a collider.

Materials are immutable, identity-shared value objects: assign one instance to many colliders and the backend will cook it once.

Constructors

PhysicsMaterial({double friction = 0.5, double restitution = 0.0, double density = 1.0, CombineRule frictionCombine = CombineRule.average, CombineRule restitutionCombine = CombineRule.average})
const

Properties

density double
Mass per unit volume. Used by the backend to derive mass and inertia from the collider's Shape when the owning rigid body has no explicit mass set.
final
friction double
Coulomb friction coefficient. Typical range is [0, 1]; higher values produce more resistance to sliding.
final
frictionCombine CombineRule
Rule for combining this material's friction with the other participating material's friction at a contact.
final
hashCode int
The hash code for this object.
no setterinherited
restitution double
Bounciness, in [0, 1]. 0 is fully inelastic; 1 preserves kinetic energy on bounce.
final
restitutionCombine CombineRule
Rule for combining this material's restitution with the other participating material's restitution at a contact.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultMaterial → const PhysicsMaterial
Reasonable defaults: friction 0.5, restitution 0.0, density 1.0, both combine rules CombineRule.average.