From e69ad01e700e80fa959dfee08cd556ca0d777ffd Mon Sep 17 00:00:00 2001 From: skylar Date: Sun, 1 Nov 2026 05:43:24 -0800 Subject: Yesod: self-hosted WebXR rooms Start a room in a world and hang out in VR from the headset's browser: A-Frame + Networked-A-Frame over EasyRTC, with a coturn relay that can hide everyone's IP address. Ships with the Campfire, Temple, Cabin, Balcony and Test room worlds. Co-Authored-By: Claude Opus 5.5 --- public/js/schemas.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 public/js/schemas.js (limited to 'public/js/schemas.js') diff --git a/public/js/schemas.js b/public/js/schemas.js new file mode 100644 index 0000000..e32a202 --- /dev/null +++ b/public/js/schemas.js @@ -0,0 +1,32 @@ +/* global AFRAME, NAF */ +// Hand models are served from here rather than cdn.aframe.io. +AFRAME.components['networked-hand-controls'].Component.prototype.MODEL_BASE = 'assets/hands/'; + +// What gets synced for each networked template. The templates live in the page +// body, which isn't parsed yet when this runs, so register lazily on first use +// (see networked-aframe issue #267). +(function () { + const vector = (precision) => NAF.utils.vectorRequiresUpdate(precision); + + const schemas = { + '#rig-template': [ + { component: 'position', requiresNetworkUpdate: vector(0.001) }, + { component: 'rotation', requiresNetworkUpdate: vector(0.5) }, + 'player-info', + ], + '#head-template': [ + { component: 'position', requiresNetworkUpdate: vector(0.001) }, + { component: 'rotation', requiresNetworkUpdate: vector(0.5) }, + ], + }; + + const original = NAF.schemas.getComponents.bind(NAF.schemas); + NAF.schemas.getComponents = (template) => { + for (const [name, components] of Object.entries(schemas)) { + if (!NAF.schemas.hasTemplate(name)) { + NAF.schemas.add({ template: name, components }); + } + } + return original(template); + }; +})(); -- cgit v1.2.3