pub struct SurfaceMaterial {
pub friction: f64,
pub restitution: f64,
pub friction_combine: CombineRule,
pub restitution_combine: CombineRule,
}Expand description
A surface’s friction and restitution, and how each combines with the surface it touches.
Fields§
§friction: f64The coefficient of friction, zero or more: the ratio of the tangential force a contact can resist to the normal force pressing it.
restitution: f64The coefficient of restitution, from zero (no bounce) to one (a perfectly elastic bounce): the ratio of separating to approaching speed.
friction_combine: CombineRuleHow friction combines with the other surface’s.
restitution_combine: CombineRuleHow restitution combines with the other
surface’s.
Implementations§
Source§impl SurfaceMaterial
impl SurfaceMaterial
Sourcepub const DEFAULT: Self
pub const DEFAULT: Self
Friction 0.6 and restitution 0, both averaged: Unity’s default physics material, and Box2D’s default friction.
Sourcepub const fn new(friction: f64, restitution: f64) -> Self
pub const fn new(friction: f64, restitution: f64) -> Self
A material with these coefficients and both combined by
CombineRule::Average.
Sourcepub fn combine(&self, other: &Self) -> ContactMaterial
pub fn combine(&self, other: &Self) -> ContactMaterial
The friction and restitution a contact between self and other
uses, each under the rule of higher precedence the two ask for.
Symmetric: which surface is self does not change the answer.