Fix the offscreen target indicator flickering when targeting a subsystem on a distant ship - #7792
Open
Goober5000 wants to merge 3 commits into
Open
Goober5000 wants to merge 3 commits into
Goober5000 wants to merge 3 commits into
Conversation
The expression used & instead of |, so neither PF_OVERFLOW nor PF_PROJECTED was ever set on that path. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Goober5000
force-pushed
the
fix/offscreen_indicator
branch
from
September 18, 2026 04:00
c81b934 to
aeace65
Compare
… list entries The projected point was the subsystem but the stored position was the hull centre, so the offscreen indicator sized its triangles for a different point than the one it clipped against. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n and direction HudGaugeOffscreen::calculatePosition could return without writing its outputs, either when the eye vertex overflowed or when the clipped point landed a pixel or two inside the clip rectangle. The caller drew anyway, so the indicator appeared at a random spot with a random orientation that changed every frame. This showed up when targeting a subsystem on a distant ship, where the clip loses enough precision to hit the second case. calculatePosition now returns whether it found a position, and both callers skip drawing when it did not. The inside case falls back to the nearest screen edge, since the point is already known to be off screen, so the indicator stays steady instead of blinking. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Goober5000
force-pushed
the
fix/offscreen_indicator
branch
from
September 18, 2026 04:50
aeace65 to
12323ef
Compare
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.
A bug report described the indicator flickering between different shapes when a subsystem defined by a POF special point was targeted on a far away ship. The cause is in HudGaugeOffscreen::calculatePosition, which could return without writing its outputs: when the eye vertex overflowed, or when the clipped point landed a pixel or two inside the clip rectangle. The caller drew anyway, so the triangle was placed at an uninitialized position with an uninitialized direction, both changing every frame.
The clip against the view frustum should leave the point exactly on a screen edge, and the edge tests allow only about one pixel of slack. Precision degrades with distance because the point is interpolated along a segment tens of kilometres long and ends up near the view apex, so at long range it can drift inside the edge and fall through.
calculatePosition now returns whether it found a position, and both its callers (the gauge and the Lua drawOffscreenIndicator function) skip drawing when it did not. The inside case falls back to the nearest screen edge, since the point is already known to be off screen, so the indicator stays steady rather than blinking.
Two related fixes found along the way: