diff --git a/ivp_intern/ivp_friction.cxx b/ivp_intern/ivp_friction.cxx index 6f364810..004f3e01 100644 --- a/ivp_intern/ivp_friction.cxx +++ b/ivp_intern/ivp_friction.cxx @@ -260,6 +260,19 @@ void IVP_Contact_Point::static_friction_single(const IVP_Event_Sim *es, bool IVP_Contact_Point::friction_force_local_constraint_2d_wheel( IVP_Core *core_a, IVP_Impact_Solver_Long_Term *info, const IVP_Event_Sim *es, IVP_FLOAT &flEnergy) { + // Apply material-based damping to vehicle wheels. + IVP_Material* materials[2]; + get_material_info(materials); + + const IVP_DOUBLE damping = materials[1]->get_damping(); + + if (damping != 0.0) { + IVP_U_Float_Point rotation_damping; + rotation_damping.set_to_zero(); + + core_a->damp_object(es->delta_time, &rotation_damping, damping); + } + IVP_Constraint_Car_Object *wheel = core_a->car_wheel; IVP_Constraint_Solver_Car *solver = wheel->solver_car; diff --git a/ivp_physics/ivp_material.hxx b/ivp_physics/ivp_material.hxx index 5e274fc1..ae027368 100644 --- a/ivp_physics/ivp_material.hxx +++ b/ivp_physics/ivp_material.hxx @@ -48,6 +48,7 @@ class IVP_Material { get_second_friction_factor() = 0; // second friction factor when two friction // values is enabled virtual IVP_DOUBLE get_elasticity() = 0; + virtual IVP_DOUBLE get_damping() { return 0.0; } // INTERN_START virtual IVP_DOUBLE get_adhesion() = 0; // for future releases // INTERN_END