18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-28 23:13:23 +01:00
Files
maszyna/tests/unit/test_collisions.cpp
jerrrrycho 369f58a04a feat(physics): collisions crush the ends of the vehicles, override and push them off the track
With physics.derailment new, CollisionDetect() hands a hit on the stop of the
buffers harder than the steel takes elastically to crush_hit() (collision.h):

- the weaker end crushes for good at its crush force, the vehicles take the
  limited impulse, the depth stays with the end (TCoupling::crush) and lets the
  buffers of the pair meet closer, in both models of the coupling
- the crush lets the lighter vehicle, or the one with its buffers higher, climb
  onto the other one; the end crushed by 0.15 m tears off its draw gear, with
  the brake hose both parts of the train brake in emergency, and an automatic
  coupler torn off doesn't couple again
- after the collisions of each step the force pressing the ends pushes a light
  vehicle off the track by Y / Q held for 0.05 s
- off the rails in a collision the vehicle is upright off the rails as by the
  criteria of the speed: it slides with the friction of the ballast and keeps
  taking the hits and passing the forces on, instead of standing as a wall.
  CollisionDerail and the log tell the override from the push off; a crushed
  end logs the collision

It works in CollisionDetect(), which both models of the coupling reach once
their buffers go solid, so the trains of the AI the physical model of the
coupling doesn't cover crush alike. Hits the steel takes, and the draw gear
going solid, stay the legacy collision. physics.derailment old and off keep
the legacy collisions: the rule of 15 km/h weighed by the masses, the chance
of the coupler smashed, a derailed vehicle a wall; the tests of that rule run
with old.

The buffers of a category of EN 15551 and the crush, crash zone, anticlimber
and buffer height of an end are new optional keys of BuffCoupl.
2026-11-15 12:41:41 +01:00

27 KiB