@@ -468,6 +468,7 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
468
468
{
469
469
// Clear stuff
470
470
swimming_vertical = false ;
471
+ swimming_pitch = false ;
471
472
472
473
setPitch (control.pitch );
473
474
setYaw (control.yaw );
@@ -492,7 +493,7 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
492
493
493
494
bool free_move = fly_allowed && player_settings.free_move ;
494
495
bool fast_move = fast_allowed && player_settings.fast_move ;
495
- bool pitch_fly = free_move && player_settings.pitch_fly ;
496
+ bool pitch_move = ( free_move || in_liquid) && player_settings.pitch_move ;
496
497
// When aux1_descends is enabled the fast key is used to go down, so fast isn't possible
497
498
bool fast_climb = fast_move && control.aux1 && !player_settings.aux1_descends ;
498
499
bool continuous_forward = player_settings.continuous_forward ;
@@ -685,10 +686,17 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
685
686
if (!free_move)
686
687
slip_factor = getSlipFactor (env, speedH);
687
688
689
+ // Don't sink when swimming in pitch mode
690
+ if (pitch_move && in_liquid) {
691
+ v3f controlSpeed = speedH + speedV;
692
+ if (controlSpeed.getLength () > 0 .01f )
693
+ swimming_pitch = true ;
694
+ }
695
+
688
696
// Accelerate to target speed with maximum increment
689
697
accelerate ((speedH + speedV) * physics_override_speed,
690
698
incH * physics_override_speed * slip_factor, incV * physics_override_speed,
691
- pitch_fly );
699
+ pitch_move );
692
700
}
693
701
694
702
v3s16 LocalPlayer::getStandingNodePos ()
0 commit comments