diff options
| author | skylar <me@casper> | 2026-11-01 05:43:24 -0800 |
|---|---|---|
| committer | skylar <me@casper> | 2026-11-01 05:43:24 -0800 |
| commit | e69ad01e700e80fa959dfee08cd556ca0d777ffd (patch) | |
| tree | 645fc9db2142e87a5ef302733a77ba2fec848d88 /public/js/schemas.js | |
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 <noreply@anthropic.com>
Diffstat (limited to 'public/js/schemas.js')
| -rw-r--r-- | public/js/schemas.js | 32 |
1 files changed, 32 insertions, 0 deletions
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); + }; +})(); |