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
Scale mouse/joystick sensitivity depending on FOV #11007
Conversation
I like the idea. Tested and works. Took me a minute to reason through why |
Really needed feature for FPS games. Tested, works, just two things:
|
What aspect ratio and FOV do you use? I did make it such that the speed should be equal from before the change when playing on 72 degree FOV at 16:9 aspect ratio. I verified that the commited function returns 1.0 when playing using these values. I assume that is what most people play with. |
// Multiply by a constant such that it becomes 1.0 at 72 degree FOV and | ||
// 16:9 aspect ratio to minimize disruption of existing sensitivity | ||
// settings. | ||
return tan(fov_y / 2.0f) * 1.3763818698f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this constant should be a DEFINE in order to understand what is this directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it hard to give such a constant a meaningful name so I thought it was more clear just to multiply with it and explain its purpose in the comments. If std::tan
was constexpr
in C++11 I could do the something like following which would be more clear about its purpose and where it comes from:
static constexpr float default_fov_y = 72.0f * M_PI / 180.0f;
static constexpr float constant = 1.0f / tan(default_fov_y / 2.0f);
This works for gcc but as far as I know std::tan
isn't is not guaranteed to be constexpr
in C++11.
Maybe you have a better idea what to call such a constant?
Also where should I put it? I think it is better to have a constexpr
variable in the function instead of a global macro because it is only used in that function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think the comment right above it good enough to explain it.
Off-topic: @Zughy what mods do you use for your Minetest FPS games? |
@ryvnf I didn't change the default FOV and I have a 16:9 @lhofhansl https://gitlab.com/zughy-friends-minetest/block_league (you can find it on AES server) |
Mathematically this shouldn't be the case. The sensitivity is multiplied by
which when multiplied by
|
Where are we with this? I like this feature and stand by my "One Approval". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me. Initially the movement seemed very slow to me, but I suppose that's because I'm used to the normal speed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me but we might have to add a setting for this once someone complainsnames a good usecase.
Fixes #11005 for joystick and mouse input.
How to test
Use the zoom-key and compare the mouse responsiveness when zoomed in and not. It should feel just as responsive.
Compare that to without this patch where it will feel a lot more responsive when zoomed in.