OSRS-Environment-Exporter icon indicating copy to clipboard operation
OSRS-Environment-Exporter copied to clipboard

[BUG] Camera Moving Bug

Open KaDraken opened this issue 3 years ago • 1 comments

  • [x] I am using the latest version of the exporter

Bug description

While exporting the area if you move the camera while it is still exporting, the camera will move into any direction without any inputs.

Steps to reproduce

1.Hold down any WASD Key to move the camera 2.Click on Export while still holding down one of the WASD Key input

The current behavior

https://user-images.githubusercontent.com/111709469/185812011-24aba6b9-30f1-401c-a451-158c4bfda003.mp4

The expected behavior

When moving the camera and hitting the export button, the camera should stop moving instead of moving on its own without any inputs. Though it's not a serious bug since if you move the camera a bit it'll stop drifting on its own.

KaDraken avatar Aug 21 '22 21:08 KaDraken

FWIW you'll see this behaviour in nearly every game out there, if you leave the window without releasing a key. (e.g. clicking on another window while the key is held) That's not to say it can't be solved :) just that it's a well-known issue in input handling.

The root cause is that the OS sends the "key pressed" signal to that window, but since something else is in focus when the key is released, it only sends the "key released" signal to that other window, so the first window doesn't know that the key has been released and continues to act as if it is held down.

A reasonable workaround in the code could be to clear key states in the input handler when the main window loses focus.

A workaround from the user's perspective is to hit the offending key so that the OS sends a (press and) release signal to the window for that key.

ScoreUnder avatar Aug 22 '22 00:08 ScoreUnder