Files
AR-Menu/Needle/MenuScene/src/enableXR.ts
pelpanagiotis beb8261554 Improve AR menu with multi-dish support, 3D ingredients, and shared sky HDRI.
Fix AR export/visibility per dish, load catalog GLBs at runtime, and replace per-dish HDR with one overcast sky environment for the whole menu.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 20:42:20 +03:00

25 lines
858 B
TypeScript

import { onStart, WebXR } from "@needle-tools/engine";
/**
* WebXR (AR/VR) — https://engine.needle.tools/docs/how-to-guides/xr/
*
* Unity editor (parity with Gitea): use XR Flag on content so meshes stay visible in AR; author dish
* scale for real-world size. If the scene already has WebXR from export, we only tune placement.
*/
onStart((context) => {
let webxr = context.scene.getComponentInChildren(WebXR);
if (!webxr) {
webxr = context.scene.addComponent(WebXR);
}
// Unity-exported WebXR often serializes these off; only the `if (!webxr)` branch used to set them,
// which hid Enter AR / Enter VR / Send to Quest in NeedleMenu for exported scenes.
webxr.createARButton = true;
webxr.createVRButton = true;
webxr.createSendToQuestButton = true;
webxr.autoPlace = true;
webxr.autoCenter = true;
webxr.arScale = 1;
});