Skip to content

Basic camera clamping fix#2797

Open
RedRoryOTheGlen wants to merge 1 commit into
Interkarma:masterfrom
RedRoryOTheGlen:BasicCameraClampingFix
Open

Basic camera clamping fix#2797
RedRoryOTheGlen wants to merge 1 commit into
Interkarma:masterfrom
RedRoryOTheGlen:BasicCameraClampingFix

Conversation

@RedRoryOTheGlen

Copy link
Copy Markdown
Contributor

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.

@ajrb

ajrb commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

I hadn't realised the look down clamping was also limiting looking up. Glad to see a fix for that.

@KABoissonneault KABoissonneault left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Gonna wait for playtest feedback before merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants