-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InputEventMouseMotion.Relative is tied to window size #49734
Comments
I don't know if this is intended behavior, but I think relative mouse motion in captured mouse mode should be resolution-independent, regardless of the stretch mode configured. This is how it works in most games after all. As far as I know, this depends on the configured stretch mode in the Project Settings. Compare the default Changing this will require breaking compatibility with existing projects, so it can only be done for 4.0. |
You seem to be right.
|
I'm still not 100% sure since I haven't looked at the engine code, but I suspected that InputEventMouseMotion.relative is actually tied to the size of the viewport / project width & height. So after some testing I found that the solution is multiplying the InputEventMouseMotion.relative vector by a ratio of the size of the smaller window side by the corresponding size of the viewport side. That's one hell of a sentence, I'll post the code so that I'll hopefully make more sense.
I don't know how efficient (or iefficient) it is to have this if else statement run time there is any mouse movement, but it does work, so if anyone has any ideas on how to make this more optimized then the coast's clear. |
I recorded some data in 4.1.1 that may be useful.
|
Thanks for the report! Consolidating in #34805, as this is due to the same cause. |
Godot version
v3.3.2.stable.mono.official
System information
Windows 10, GLES3, GTX 1060 3GB 27.21.14.6647
Issue description
I noticed that running my game in windowed mode at 1920x1080 results in noticeably higher mouse sensitivity than running it at 2560x1440.
Turns out the Third Person Shooter Demo suffers from the same issue. I performed roughly the same mouse movements with two different window sizes.
Left: 320x240 window, produces ~360° of camera rotation
Right: 2560x1440 window, produces ~60° of camera rotation
comparison.mp4
Thanks.
Apparent solution
In case it helps, I noticed that multiplying the relative value by the smaller window dimension results in what I percieve as the "correct" behavior, where sensitivity remains constant across different window sizes and aspect ratios.
Steps to reproduce
Minimal reproduction project
Third Person Shooter Demo
The text was updated successfully, but these errors were encountered: