mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 06:59:13 +01:00
fix(track): what the review of unevenness found in the engine
- A path of no length gave a joint with a vector across of NaN to the path joined to it, on any scenery, with unevenness or not. It now has no vector across, and so makes no joint. - Axles no longer stray along the track. It moved vehicles against each other, changing the distance their couplers go by. - The bend under an axle goes straight on past the ends of a path: the polynomial ran off on a short curved one, with a kick in the cab shake. - A track left out of its rail run, where tracks are joined one way only, no longer walks the whole run again on every call. - The clatter of an axle goes by the outer axle on its side of the vehicle, and not always by the same one, as the two can be on different tracks. - A vertex works out the amounts once, and the foot of the ballast not at all.
This commit is contained in:
@@ -3662,11 +3662,13 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
ctOwner->Vehicle()->DirectionGet() == DirectionGet() ? 1 : -1 ) };
|
||||
for( auto &axle : m_axlesounds ) {
|
||||
// on a track with dipping joints the clatter comes from them, elsewhere the axle counts a rail off itself
|
||||
auto const railphase { Axle0.RailPhase( axle.offset - 0.5 * fAxleDist ) };
|
||||
// by the outer axle on its side of the vehicle: the two can be on different tracks
|
||||
auto const &outer { axle.offset >= 0.0 ? Axle0 : Axle1 };
|
||||
auto const railphase { outer.RailPhase( axle.offset - std::copysign( 0.5 * fAxleDist, axle.offset ) ) };
|
||||
auto crossed { false };
|
||||
if( railphase >= 0.0 ) {
|
||||
// the rails under the axle, which aren't always those under the track the vehicle is on
|
||||
crossed = axle.atjoints && std::abs( railphase - axle.distance ) > 0.5 * Axle0.GetTrack()->fSoundDistance;
|
||||
crossed = axle.atjoints && std::abs( railphase - axle.distance ) > 0.5 * outer.GetTrack()->fSoundDistance;
|
||||
axle.distance = railphase;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user