metrostroi-repo / MetrostroiAddon

Metrostroi is an addon for Garry's Mod which puts you behind the controls of the real and fully simulated subway trains.
https://metrostroi.net
Other
40 stars 29 forks source link

Allow train entities to opt out of automatic rerailing #577

Open LillyWho opened 1 year ago

LillyWho commented 1 year ago

Custom trains, particularly long, three+-section articulated ones face issues if the couplers are parented onto the correct sections. Not parenting them onto the sections they belong to leads to an incorrect application of the axis/ballsocket constraints, making the couplers sag to the ground. However the rerail routines incorrectly calculate the positioning for moving the couplers based on the main entity, making the whole contraption glitch out.

For reference, my design for eight axle trains is such:

A-C-B

C being the brain of the train while B and A are control cars to the logic in the mid section. Spawning from the middle outward also gives the advantage of avoiding further physics weirdness. For now, this is a small hack that won't affect Mainline Metrostroi trains and the rerail code doesn't have to be changed in greater detail.

image image