Add XrMenu script and example for WebXR hand/controller menus#8407
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive WebXR menu system for the PlayCanvas engine with support for both hand tracking and controller inputs. The XrMenu script provides a hybrid UI that can detect palm gestures in hand tracking mode or toggle via controller buttons.
Changes:
- Adds
XrMenuESM script with hand tracking palm detection, controller button toggle, and PlayCanvas UI integration for rendering menus - Adds
xr-menuexample demonstrating the menu in a VR gallery with physics-enabled cube spawning and interactive features - Includes supporting assets (button texture, click sound, font, thumbnails)
Reviewed changes
Copilot reviewed 5 out of 10 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/esm/xr-menu.mjs | New XrMenu script implementing hybrid WebXR menu with hand/controller support, palm gesture detection, and UI rendering |
| examples/src/examples/xr/xr-menu.example.mjs | Example demonstrating XrMenu integration with XR session, controllers, navigation, and physics |
| examples/src/examples/xr/xr-menu.ui.html | HTML template for AR/VR entry buttons |
| examples/src/examples/xr/xr-menu.ui.css | Styling for UI buttons and messages |
| examples/assets/textures/blue-button.png | Button texture asset for menu appearance |
| examples/assets/sounds/click.mp3 | Audio feedback for button interactions |
| examples/assets/fonts/roboto-extralight.json | Font asset for menu text rendering |
| examples/thumbnails/xr_xr-menu_small.webp | Small thumbnail for example |
| examples/thumbnails/xr_xr-menu_large.webp | Large thumbnail for example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
slimbuck
approved these changes
Jan 25, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
willeastcott
added a commit
that referenced
this pull request
Jan 26, 2026
* Add XR Menu script and example * Add XR gallery environment * Add physics * Improve AR and VR buttons * Simplify example code * Add camera controls * Polish * Tweak menu position in relation to the palm * Add click sound * Tweak lag and offset * Add thumbs * Update examples/src/examples/xr/xr-menu.example.mjs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Implement feedback * Fix docs about xr:menu:active event * Use BUTTON_TRANSITION_MODE_TINT constant * Improve JSDoc * Update scripts/esm/xr-menu.mjs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update scripts/esm/xr-menu.mjs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Improve JSDoc * Tweak colors --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Summary
xr-palm-menu-physics.mp4
XrMenuESM script that provides a hybrid WebXR menu system supporting both hand tracking and controllersxr-menuexample demonstrating the menu in a VR gallery with interactive featuresXrMenu Script Features
xr:input:blockedevent to coordinate with navigation scriptsExample Features
Checklist