Skip to content

bugfix(view): Recalculate Camera Area Constraints when toggling Control Bar or changing Pitch, FOV#2291

Merged
xezon merged 1 commit intoTheSuperHackers:mainfrom
xezon:xezon/fix-camera-area-recalc
Feb 12, 2026
Merged

bugfix(view): Recalculate Camera Area Constraints when toggling Control Bar or changing Pitch, FOV#2291
xezon merged 1 commit intoTheSuperHackers:mainfrom
xezon:xezon/fix-camera-area-recalc

Conversation

@xezon
Copy link

@xezon xezon commented Feb 10, 2026

This change recalculates the Camera Area Constraints when toggling the Control Bar or changing Camera Pitch or FOV. Right now Pitch and FOV can only be changed in Debug. But it will become available in Release in the future.

The Camera Area Constraints are responsible for binding the camera into the visible map area, preventing the player from scrolling into oblivion.

@xezon xezon added Bug Something is not working right, typically is user facing Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Feb 10, 2026
@greptile-apps
Copy link

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

This PR fixes a bug where camera area constraints were not being recalculated when the viewport dimensions changed (toggling control bar) or when camera properties like pitch and FOV were modified. The fix properly invalidates m_cameraAreaConstraintsValid in all relevant functions, ensuring that the camera boundary calculations are updated to reflect the new viewport or camera configuration.

The changes follow the existing pattern used throughout the codebase where m_cameraAreaConstraintsValid is set to false alongside m_recalcCamera = true whenever camera properties change. The implementation is consistent with other camera modification functions like forceRedraw(), setCameraHomePosition(), and various camera movement functions.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes follow an established and consistent pattern used throughout the codebase. Setting m_cameraAreaConstraintsValid = false is the standard way to invalidate camera constraints, and this flag is properly checked and recalculated in the render loop. The bug fix addresses a legitimate issue where viewport changes weren't triggering constraint recalculation.
  • No files require special attention

Important Files Changed

Filename Overview
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp Adds m_cameraAreaConstraintsValid = false to invalidate camera constraints when viewport dimensions or camera properties change, ensuring constraints are recalculated properly

Copy link

@Mauller Mauller left a comment

Choose a reason for hiding this comment

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

Sense it makes

m_doingPitchCamera = false;
m_doingZoomCamera = false;
m_doingScriptedCameraLock = false;
// TheSuperHackers @fix Now recalculates the camera constraints because

Choose a reason for hiding this comment

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

Add empty line before comment

Copy link
Author

Choose a reason for hiding this comment

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

Negative. A future change will remove the lines above. That is why it looks cramped right now.

@xezon xezon merged commit 5dce9d9 into TheSuperHackers:main Feb 12, 2026
24 checks passed
@xezon xezon deleted the xezon/fix-camera-area-recalc branch February 12, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants