Skip to content

fix(highway_3d): stop the lane at the hit line - #994

Merged
topkoa merged 1 commit into
mainfrom
fix/991-lane-stops-at-hit-line
Jul 16, 2026
Merged

topkoa merged 1 commit into
mainfrom
fix/991-lane-stops-at-hit-line

Conversation

@topkoa

@topkoa topkoa commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Closes #991.

The bug

The lane maps chart time to z exactly the way notes do — z = dZ(t - now) — across the window [now - BEHIND, now + AHEAD]. That puts its near edge at +TS*BEHIND: half a second of lane sitting past the hit line, toward the player.

Nothing is ever drawn there. drawNote clamps every note with Math.min(0, dZ(dt)), and the chord frames do the same, so notes stop dead at z = 0. The strip past the line was therefore lane surface with nothing on it — the artifact in the issue screenshot.

The fix

Clamp the floor geometry's near edge to the hit line. That's it.

The far edge is deliberately untouched — it still lands at -AHEAD*TS, aligned with the note horizon. That matters: a previous fix (still commented in the code) widened the span to AHEAD + BEHIND precisely so the far edge would reach the horizon, because using AHEAD alone stopped it at -TS*(AHEAD-BEHIND) and left the last BEHIND seconds of notes with no lane underneath. So the sliced path keeps its AHEAD + BEHIND window and the clamp is applied per slice; a slice lying entirely past the line collapses to zero length and is skipped before the arpeggio probe, so it costs nothing.

Verified numerically, both lane paths now span exactly [-AHEAD*TS, 0]:

Path Near edge Far edge
Anchor / sliced 0.000000 (hit line) -5.175000 = -AHEAD*TS
Fallback 0.000000 -5.175000

Why all four sites

Four places shared the identical + TS * BEHIND shift, and they're one invariant — highway floor geometry that should stop at the hit line:

  1. Sliced/anchor lane (z0/z1 per slice) — also feeds both divider loops, so those are fixed for free.
  2. Fallback lane quads (laneLen/zLane) — also feeds the arpeggio outer dividers.
  3. Fallback plain dividers (divLen).
  4. Fret boundary extension lines (extZMid).

#4 is included on purpose: those lines share the same expression, so fixing only the lane would leave fret lines poking past a lane that now stops — visually worse than the original. Happy to narrow it to the lane proper if that's preferred.

Notes

  • Comment-heavy by design: the near/far asymmetry is exactly the kind of thing a future reader would "simplify" back into the bug, so the reason the span stays AHEAD + BEHIND is written down at the clamp.
  • JS-only plugin change — no rebuild, no new deps, no settings, no API surface. node --check clean.
  • Behaviour when Camera Director / splitscreen are active is unaffected; this is pure scene geometry.

🤖 Generated with Claude Code

The lane maps chart time to z exactly as notes do, over the window
[now - BEHIND, now + AHEAD]. That puts its near edge at +TS*BEHIND — BEHIND
seconds PAST the hit line, toward the player. Nothing is ever drawn there:
drawNote and the chord frames both clamp to Math.min(0, dZ(dt)), so notes stop
dead at z = 0. The overhang was therefore lane surface with nothing on it.

Clamp the floor geometry's near edge to the hit line. The far edge is
deliberately untouched — it still lands at -AHEAD*TS, aligned with the note
horizon, which is why the span stays AHEAD+BEHIND in the sliced path and the
clamp is applied per slice (a slice entirely past the line collapses to zero
length and is skipped before the arpeggio probe, so it costs nothing).

All four floor sites move together — the sliced lane (which also feeds both
divider loops), the fallback lane, its dividers, and the fret boundary
extension lines. They shared the identical `+ TS * BEHIND` shift; fixing only
some would leave fret lines poking past a lane that now stops.

Closes #991

Signed-off-by: Kris Anderson <topkoa@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@topkoa
topkoa merged commit 1c077c9 into main Jul 16, 2026
6 of 7 checks passed
topkoa added a commit that referenced this pull request Jul 16, 2026
Bring the branch up to date with main (includes #994, which also touched
highway_3d/screen.js — the lane hit-line fix — in a different region).
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.

Fix(3d Highway): Remove the lanes past the hit line towards the player

2 participants