From 3d454ed321871d704382de87de4d163ea0b93cbc Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 17 Apr 2025 13:27:59 +0200 Subject: [PATCH] Fix cursor locked mode when system uses Dpi scaling --- Source/Engine/Input/Input.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Input/Input.cpp b/Source/Engine/Input/Input.cpp index 9c15e6bcd..7a4d0592c 100644 --- a/Source/Engine/Input/Input.cpp +++ b/Source/Engine/Input/Input.cpp @@ -1206,7 +1206,9 @@ void InputService::Update() const auto lockMode = Screen::GetCursorLock(); if (lockMode == CursorLockMode::Locked) { - Input::SetMousePosition(Screen::GetSize() * 0.5f); + const Float2 pos = Screen::ScreenToGameViewport(Screen::GetSize() * 0.5f) - + Screen::ScreenToGameViewport(Float2::Zero); + Input::SetMousePosition(pos); } // Send events for the active actions and axes (send events only in play mode)