1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

TouchControls: Take FOV into account for camera movement (#15936)

This commit is contained in:
grorp 2025-03-28 07:43:59 -04:00 committed by GitHub
parent fbc525d683
commit b0bc6ce637
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2407,8 +2407,10 @@ f32 Game::getSensitivityScaleFactor() const
void Game::updateCameraOrientation(CameraOrientation *cam, float dtime) void Game::updateCameraOrientation(CameraOrientation *cam, float dtime)
{ {
if (g_touchcontrols) { if (g_touchcontrols) {
cam->camera_yaw += g_touchcontrols->getYawChange(); // User setting is already applied by TouchControls.
cam->camera_pitch += g_touchcontrols->getPitchChange(); f32 sens_scale = getSensitivityScaleFactor();
cam->camera_yaw += g_touchcontrols->getYawChange() * sens_scale;
cam->camera_pitch += g_touchcontrols->getPitchChange() * sens_scale;
} else { } else {
v2s32 center(driver->getScreenSize().Width / 2, driver->getScreenSize().Height / 2); v2s32 center(driver->getScreenSize().Width / 2, driver->getScreenSize().Height / 2);
v2s32 dist = input->getMousePos() - center; v2s32 dist = input->getMousePos() - center;