]> git.lizzy.rs Git - minetest.git/commitdiff
Allow direction keys with autoforward again
authorsfan5 <sfan5@live.de>
Wed, 27 Jul 2022 21:44:29 +0000 (23:44 +0200)
committersfan5 <sfan5@live.de>
Fri, 29 Jul 2022 08:19:23 +0000 (10:19 +0200)
This was unintentionally removed in commit 1d69a23.
fixes #12048

src/client/game.cpp

index caa83ce136d5e72a7395b613d8b17df531b29468..61b957e78b96d7cccd88824780ca12f4f579b734 100644 (file)
@@ -2510,11 +2510,13 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
                input->getMovementDirection()
        );
 
-       // autoforward if set: move towards pointed position at maximum speed
+       // autoforward if set: move at maximum speed
        if (player->getPlayerSettings().continuous_forward &&
                        client->activeObjectsReceived() && !player->isDead()) {
                control.movement_speed = 1.0f;
-               control.movement_direction = 0.0f;
+               // sideways movement only
+               float dx = sin(control.movement_direction);
+               control.movement_direction = atan2(dx, 1.0f);
        }
 
 #ifdef HAVE_TOUCHSCREENGUI