Skip to content

feat(xr): XrMenu label items, ray picking, always-visible HUD mode#8770

Merged
mvaligursky merged 2 commits into
mainfrom
mv-xr-menu-hud
May 22, 2026
Merged

feat(xr): XrMenu label items, ray picking, always-visible HUD mode#8770
mvaligursky merged 2 commits into
mainfrom
mv-xr-menu-hud

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

Extend XrMenu with label-only items, runtime label updates, custom XR ray picking, and an always-visible camera-anchored mode. Adds a new vr-test-bed example that uses these features as an in-VR debug HUD for tweaking app.xr.fixedFoveation.

Changes:

  • XrMenu items without an eventName now render as non-interactive labels (skipped click/hover, dimmer text). Useful for value readouts alongside interactive buttons.
  • New XrMenu#setItemLabel(index, text) method updates the displayed text of any item at runtime; persists into menuItems so it survives a future regeneration. No more toUpperCase() on labels — caller controls casing.
  • New XrMenu#alwaysVisible mode: the menu stays up for the entire XR session and follows the camera. Configurable with followDistance and followOffset (Vec2 — camera-local right + up).
  • Self-contained XR ray picking — uses each button element's worldCorners for ray-vs-plane interaction and edge-detects the controller trigger for clicks. Does not depend on ElementInput's XR hover events (which are unreliable on some runtimes).
  • Restyled defaults: slate background, cyan hover/press, near-white text. Improves contrast on the previous light-gray look.
  • Press cooldown debounce in _onButtonClick to avoid double-firing when multiple input paths see the same press.

API Changes:

  • New XrMenu#setItemLabel(index, text): boolean — updates an item's text.
  • New attributes: alwaysVisible: boolean, followDistance: number, followOffset: Vec2, labelTextOpacity: number.
  • Item shape: { label } (no eventName) is now a valid label-only row.
  • Label text is no longer auto-uppercased; existing xr-menu example labels were updated to preserve the previous visual.

Examples:

  • New examples/src/examples/xr/vr-test-bed.example.mjs: always-visible HUD with foveation toggle / +/- / exit buttons, controller-ray drawing, and a known WebGPU-foveation-on-Quest-3 caveat documented in-code.
  • xr-menu example: pre-uppercased the three menu labels so its visual output is unchanged after dropping the implicit uppercase.
  • New thumbnails for vr-test-bed; updated vr-basic thumbnail to match since both render the same gallery scene.

Extend XrMenu with label-only items, runtime label updates, custom XR
ray picking, and an always-visible camera-anchored mode. Adds a new
vr-test-bed example that uses these features as an in-VR debug HUD for
tweaking app.xr.fixedFoveation.

Changes:
- Items without an eventName render as non-interactive labels (skipped
  click/hover, dimmer text).
- New XrMenu#setItemLabel(index, text) updates an item's text at
  runtime; persists into menuItems. Label text is no longer
  auto-uppercased — caller controls casing.
- New alwaysVisible mode + followDistance / followOffset (Vec2) keeps
  the menu pinned to the camera for the whole session.
- Self-contained XR ray picking via element worldCorners; trigger
  edge-detect for clicks. Does not depend on ElementInput XR hover.
- Restyled defaults: slate background, cyan hover/press, near-white
  text.
- Press cooldown debounce in _onButtonClick.

Examples:
- New vr-test-bed example: always-visible HUD with foveation toggle /
  +/- / exit buttons, controller-ray drawing.
- xr-menu example: pre-uppercased the three labels so its visual
  output is unchanged after dropping the implicit uppercase.
- New thumbnails for vr-test-bed; updated vr-basic thumbnail to match
  since both render the same gallery scene.
Removes the localStorage-backed logger, _onButtonClick wrapper, global error nets, and per-handler tracing that were added while investigating the WebGPU foveation crash on Quest 3. Functionality is unchanged; clears the CI lint errors (no-use-before-define, brace-style, arrow-parens).
@mvaligursky mvaligursky merged commit 83a5840 into main May 22, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-xr-menu-hud branch May 22, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant