#[derive(Debug, Clone)]
pub struct ContactMaterial {
pub stiffness: f64,
pub damping: f64,
pub friction: f64,
pub bounce: f64,
pub soft_cfm: f64,
pub soft_erp: f64,
}
impl Default for ContactMaterial {
fn default() -> Self {
Self {
stiffness: 10000.0,
damping: 100.0,
friction: 0.5,
bounce: 0.0,
soft_cfm: 0.0001,
soft_erp: 0.2,
}
}
}
impl ContactMaterial {
pub fn new(stiffness: f64, damping: f64, friction: f64, bounce: f64) -> Self {
Self {
stiffness,
damping,
friction,
bounce,
soft_cfm: 0.0001,
soft_erp: 0.2,
}
}
pub fn bouncy() -> Self {
Self {
stiffness: 10000.0,
damping: 50.0,
friction: 0.3,
bounce: 0.8,
soft_cfm: 0.0001,
soft_erp: 0.2,
}
}
pub fn soft() -> Self {
Self {
stiffness: 1000.0,
damping: 200.0,
friction: 0.7,
bounce: 0.1,
soft_cfm: 0.001,
soft_erp: 0.2,
}
}
pub fn rigid() -> Self {
Self {
stiffness: 50000.0,
damping: 100.0,
friction: 0.5,
bounce: 0.0,
soft_cfm: 0.00001,
soft_erp: 0.2,
}
}
}