18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 22:04:59 +01:00

feat(physics): physical coupler model for the player's train and those it closes in on, plastic hit on solid buffers

This commit is contained in:
2026-11-11 03:15:58 +01:00
parent aba8687678
commit 226155d430
10 changed files with 271 additions and 11 deletions

View File

@@ -211,6 +211,12 @@ link_strength weaker_link(end_parameters const &First, end_parameters const &Sec
return link;
}
double solid_hit_loss(end_parameters const &First, end_parameters const &Second) {
// the collision needs some bounce left (ComputeCollision() asserts it)
auto const restitution{std::clamp(0.5 * (First.solid_restitution + Second.solid_restitution), 0.05, 0.95)};
return 1.0 - restitution * restitution;
}
void pair_state::couple() {
draw_gear.reset();
elongation = 0.0;