17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 06:59:13 +01:00

feat(vehicle): an uneven track shakes the cab by itself

On such a track the sway drawn from the lateral acceleration, that is
from the curve radius, and the jolts drawn at random are off. Tracks
with no unevenness shake the cab as before. Hunting stays: it goes by the
vehicle and its speed, not by the track.
This commit is contained in:
maj00r
2026-10-31 18:29:22 +01:00
parent 3dbe8a75f8
commit 7aff1ee9ff
2 changed files with 6 additions and 2 deletions

View File

@@ -8043,10 +8043,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() };
if( iVel > 0.5 ) {
// acceleration-driven base shake
shakevector += glm::dvec3(
-MoverParameters->AccN * Timedelta * 5.0 * Global.ShakingMultiplierRL, // highlight side sway
uneven ? 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
@@ -8059,7 +8061,7 @@ TDynamicObject::update_shake( double const Timedelta ) {
auto shake { 1.25 * ShakeSpring.ComputateForces( shakevector, ShakeState.offset ) };
if( LocalRandom( iVel ) > 25.0 ) {
if( false == uneven && LocalRandom( iVel ) > 25.0 ) {
// extra shake at increased velocity
shake += ShakeSpring.ComputateForces(
glm::dvec3(