18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 23:57:09 +01:00
Files
maszyna/tests/unit/test_collisions.cpp
jerrrrycho f90005e649 fix(physics): a legacy derailment makes no crash inside its own train
With physics.collisions new and the legacy derailment (the default
physics.derailment monitor), a vehicle derailed the old way manufactured
collisions with the vehicles coupled to it:

- Derail() cuts its speed by 35 % in one step; the coupled vehicles kept
  theirs and ran into it at a third of the speed of the train
  (moczniki_eu06_eu07, tomaszewo_raj49843). The vehicles coupled to it
  now get the same change of velocity.
- crush_hit() took it as an immovable wall and its motion ignored every
  force (decelerating at g, then stuck by resistances x1e20), so the
  train behind it stopped against it at once and crushed by the energy
  of the whole train (l053-sluzba-2-night: 0.3 m on both ends at 8 km/h).
  It is now a wall only to vehicles not coupled to it; it keeps the
  legacy deceleration of g as a friction of its weight, and the forces
  of its train act on it, so the train pushes it on and it holds the
  train back. Alone it stops as before.
- Vehicles of the pile-up found inside each other kept what their
  springs took in pressed past the stop as buffer energy, which let a
  later small closing velocity crush them; a pair parting at the start of
  the step and knocked back in during it was crushed with the springs
  added to its closing velocity (l053_calkowo-sluzba-tlk-1,
  linia61_osobowy3: crush at -7.1 km/h). The contact found inside each
  other takes in nothing until the buffers part, and a pair parting at
  the start of the step is left to the legacy collision.

The monitor test of a locomotive into a wagon at 60 km/h now counts one
hit: the second one was the locomotive resting on the legacy wall,
parting at the start of the step, at 0.3 km/h.
2026-11-17 17:36:15 +01:00

65 KiB