Initial commit: Unity Needle AR Menu project with MenuScene and SampleScene web apps
Add root .gitignore for Unity Library/Temp/Logs, IDE folders, and node_modules. Include Assets, Needle TypeScript (MenuController, asset picker, WebXR), and project configuration. Made-with: Cursor
This commit is contained in:
20
Needle/MenuScene/src/enableXR.ts
Normal file
20
Needle/MenuScene/src/enableXR.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
webxr.createARButton = true;
|
||||
webxr.createVRButton = true;
|
||||
}
|
||||
|
||||
webxr.autoPlace = true;
|
||||
webxr.autoCenter = true;
|
||||
webxr.arScale = 1;
|
||||
});
|
||||
Reference in New Issue
Block a user