Skip to content

bugfix(view): Fix malformed camera area constraints during cutscenes#2587

Merged
xezon merged 2 commits intoTheSuperHackers:mainfrom
xezon:xezon/fix-view-malformed-contraints
Apr 12, 2026
Merged

bugfix(view): Fix malformed camera area constraints during cutscenes#2587
xezon merged 2 commits intoTheSuperHackers:mainfrom
xezon:xezon/fix-view-malformed-contraints

Conversation

@xezon
Copy link
Copy Markdown

@xezon xezon commented Apr 12, 2026

@xezon xezon added this to the Camera Improvements milestone Apr 12, 2026
@xezon xezon added Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project labels Apr 12, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 12, 2026

Greptile Summary

This PR fixes malformed camera area constraints during cutscenes via two complementary changes: skipping updateCameraAreaConstraints() during scripted camera movements, and clamping the computed offset to at most half the map extent in each dimension to prevent inverted constraint regions.

The calcCameraAreaOffset refactor also moves the isLookingDown computation inside the function (deriving it from the pick ray rather than the camera-forward vector) and adds an early-return guard for near-horizontal camera angles that would previously produce near-infinite offsets.

Confidence Score: 5/5

This PR is safe to merge; the fix is targeted and correctly addresses the cutscene constraint bug on all identified paths.

No P0 or P1 issues found. The !didScriptedMovement guard cleanly prevents constraint clamping during cutscenes. The std::min clamping to half-map-extent is a robust guard against inverted regions. The isLookingDown refactor is logically equivalent to the old approach. All remaining findings are P2 or non-issues.

No files require special attention.

Important Files Changed

Filename Overview
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp Core fix: updateCameraAreaConstraints() gated on !didScriptedMovement; offset clamped to half map size; horizon guard added in calcCameraAreaOffset; isLookingDown correctly derived from pick ray inside function. No issues found.
Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h Declaration updated to remove the Bool isLookingDown parameter from calcCameraAreaOffset, matching the implementation change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[W3DView::update] --> B{didScriptedMovement?}
    B -- Yes --> C[Skip updateCameraAreaConstraints\ncutscene/scripted camera free to move]
    B -- No --> D[updateCameraAreaConstraints]
    D --> E{m_cameraAreaConstraintsValid?}
    E -- No --> F[calcCameraAreaConstraints]
    F --> G{TheTerrainLogic?}
    G -- No --> H[return — constraints remain invalid]
    G -- Yes --> I[Set camera transform\nCall calcCameraAreaOffset]
    I --> J{ray Z delta < 1.0f?\nnear-horizontal}
    J -- Yes --> K[return 1e+6f]
    J -- No --> L[Compute offset from pick rays]
    K --> M[std::min offset to half map X]
    L --> M
    M --> N[std::min offset to half map Y]
    N --> O[Apply constraints lo/hi\nSet m_cameraAreaConstraintsValid = true]
    E -- Yes --> P{isWithinCameraAreaConstraints?}
    O --> P
    P -- No --> Q[clipCameraIntoAreaConstraints]
    P -- Yes --> R[Done]
    Q --> R
Loading

Reviews (2): Last reviewed commit: "Revert change to m_cameraAreaConstraints..." | Re-trigger Greptile

@xezon xezon merged commit a48131d into TheSuperHackers:main Apr 12, 2026
17 checks passed
@xezon xezon deleted the xezon/fix-view-malformed-contraints branch April 12, 2026 14:27
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 Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

USA Campaign Mission 2 – Black Screen after Cinematic Intro USA Campaign Mission 2 – Cinematic Intro Black Screen

2 participants