Basic camera clamping fix#2797
Open
RedRoryOTheGlen wants to merge 1 commit into
Open
Conversation
…lookTarget vector.
Collaborator
|
I hadn't realised the look down clamping was also limiting looking up. Glad to see a fix for that. |
KABoissonneault
approved these changes
Jun 9, 2026
KABoissonneault
left a comment
Collaborator
There was a problem hiding this comment.
Code looks good. Gonna wait for playtest feedback before merging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Swaps and reverses the signs of the min and max pitch values when clamping the lookTarget vector in PlayerMouseLook.
Following up from my testing of PR #2704, I figured that the issue was stemming from vectors and angles treating signed values differently. When used in angles, a positive value limits how far you can look down and vice versa for negative values. In vectors, a positive Y-value rotates the vector to point upwards.
At first, I commented out the line clamping the vector in Update and the individual clamping values started working. On the other hand, the unclamped vector caused the player's camera to get stuck if the target vector's pitch was beyond the min/max bounds.
I then decided to just reverse the signs and swap pitch values on the vector clamping and it worked. I then tested it with the vanilla attack control scheme and some mods.
To illustrate: Video of Enhanced Riding from Roleplay & Realism by @ajrb.
In the above video Enhanced Riding limits how far the player can look down, but the current release causes both up/down to be limited. With this fix, the player can now look up freely while being limited when looking down.
I also tested it with Free Rein and Auto-Sight and they also worked just as well, so in addition to fixing the clamping, the original usage of the SetFacing methods is preserved.