fix: correct fog of war coordinate system (Y vs Z axis mismatch)#1241
Merged
Conversation
The fog of war was broken on some maps (100% coverage) and inverted on others (moving south revealed north) due to coordinate system mismatches: 1. VisionSystem used transform.y (altitude) instead of transform.z (depth) when calculating vision grid cells 2. CPU texture path had an inconsistent Y-flip that didn't match GPU path or shader expectations 3. Map dimensions weren't being passed to the fog shader, causing hardcoded 256x256 to mismatch actual map sizes (e.g., 320x320) Changes: - VisionSystem.ts: Use transform.z for all vision calculations - FogOfWar.ts: Remove Y-flip in CPU path to match GPU/shader - EffectPasses.ts: Add setMapDimensions() for dynamic map sizing - PostProcessing.ts: Use setMapDimensions() with cell size - VisionCompute.ts: Rename worldY→worldZ for clarity - BuildingRenderer.ts, UnitRenderer.ts: Use transform.z for checks - Minimap.tsx: Use transform.z for position and vision checks https://claude.ai/code/session_013Hqn3PxBW8h7hpMNMKKv1e
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.
The fog of war was broken on some maps (100% coverage) and inverted on others (moving south revealed north) due to coordinate system mismatches:
Changes:
https://claude.ai/code/session_013Hqn3PxBW8h7hpMNMKKv1e