mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 22:07:20 +01:00
fix(track): the cab keeps the shake a track doesn't replace, and the editor redraws all that an edit changes
The side sway from the lateral acceleration now goes off only on a track with a sideways value, and the random jolts on one with a vertical or a sideways value. Dips at the rail joints and cross level alone replace neither. On a switch it goes by the path set and what its joined tracks allow. An edit in the editor also rebuilds the other switches of a joined group with the tracks they meet, and the tracks of a rail run whose joints moved. Removing a track does the same. While dragging, the tracks further off wait until the drag ends. The clatter of a bogie's axles was right: the followers stand at the pivots and the offsets are the places of the wheel sets. The misleading name goes. Also what Sonar had left: a parameter as a span, a const method, a struct and its member apart, commented out code, and a function of the grading tool split, with the same output.
This commit is contained in:
@@ -3381,7 +3381,6 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
&& MoverParameters->eimc[eimc_p_abed] < 0.001)
|
||||
FzadED = 0; //pętla bezpieczeństwa - bez ED
|
||||
auto const FzadPN = Fzad - FrED * MoverParameters->MED_FrED_factor;
|
||||
//np = 0;
|
||||
std::vector<bool> PrzekrF( np );
|
||||
float nPrzekrF = 0;
|
||||
bool test = true;
|
||||
@@ -8019,12 +8018,12 @@ TDynamicObject::update_shake( double const Timedelta ) {
|
||||
shakevector *= 0;
|
||||
|
||||
auto const iVel { std::min( GetVelocity(), 150.0 ) };
|
||||
// an uneven track shakes the cab by itself, in place of the sway drawn from the curve and the jolts drawn at random
|
||||
auto const uneven { MyTrack != nullptr && MyTrack->is_uneven() };
|
||||
// an uneven track shakes the cab by itself, in place of the sway drawn from the curve and the jolts drawn at random, as far as it does
|
||||
auto const replaced { track_uneven::replaced_shake( MyTrack != nullptr ? MyTrack->uneven_underway() : track_uneven::amounts {} ) };
|
||||
if( iVel > 0.5 ) {
|
||||
// acceleration-driven base shake
|
||||
shakevector += glm::dvec3(
|
||||
uneven ? 0.0 : -MoverParameters->AccN * Timedelta * 5.0 * Global.ShakingMultiplierRL, // highlight side sway
|
||||
replaced.sway ? 0.0 : -MoverParameters->AccN * Timedelta * 5.0 * Global.ShakingMultiplierRL, // highlight side sway
|
||||
-MoverParameters->AccVert * Timedelta * Global.ShakingMultiplierUD,
|
||||
-MoverParameters->AccSVBased * Timedelta * 1.5 * Global.ShakingMultiplierBF); // accent acceleration/deceleration
|
||||
// unevenness of the track under the outer axles
|
||||
@@ -8037,7 +8036,7 @@ TDynamicObject::update_shake( double const Timedelta ) {
|
||||
|
||||
auto shake { 1.25 * ShakeSpring.ComputateForces( shakevector, ShakeState.offset ) };
|
||||
|
||||
if( false == uneven && LocalRandom( iVel ) > 25.0 ) {
|
||||
if( false == replaced.jolts && LocalRandom( iVel ) > 25.0 ) {
|
||||
// extra shake at increased velocity
|
||||
shake += ShakeSpring.ComputateForces(
|
||||
glm::dvec3(
|
||||
@@ -8066,11 +8065,12 @@ TDynamicObject::update_shake( double const Timedelta ) {
|
||||
bool
|
||||
TDynamicObject::axle_passed_joint( axle_sounds &Axle, double const Move, int const Direction ) const {
|
||||
|
||||
// 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 };
|
||||
if( auto const railphase { outer.RailPhase( Axle.offset - std::copysign( 0.5 * fAxleDist, Axle.offset ) ) }; railphase >= 0.0 ) {
|
||||
// from the follower on its side of the vehicle, as the two can be on different tracks. They stand fAxleDist apart, at the bogie pivots, and
|
||||
// the offset of the axle is the place of its wheel set, so the two of a bogie come out half of ADist to either side of the pivot
|
||||
auto const &follower { Axle.offset >= 0.0 ? Axle0 : Axle1 };
|
||||
if( auto const railphase { follower.RailPhase( Axle.offset - std::copysign( 0.5 * fAxleDist, Axle.offset ) ) }; railphase >= 0.0 ) {
|
||||
// the rails under the axle, which aren't always those under the track the vehicle is on
|
||||
auto const passed { Axle.atjoints && std::abs( railphase - Axle.distance ) > 0.5 * outer.GetTrack()->fSoundDistance };
|
||||
auto const passed { Axle.atjoints && std::abs( railphase - Axle.distance ) > 0.5 * follower.GetTrack()->fSoundDistance };
|
||||
Axle.distance = railphase;
|
||||
Axle.atjoints = true;
|
||||
return passed;
|
||||
|
||||
Reference in New Issue
Block a user