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/world.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 public/js/world.js (limited to 'public/js/world.js') diff --git a/public/js/world.js b/public/js/world.js new file mode 100644 index 0000000..caf1cf4 --- /dev/null +++ b/public/js/world.js @@ -0,0 +1,22 @@ +/* global AFRAME */ +// The world that's loaded (campfire, temple, …) is the entity marked +// `data-world=""` in its template. Its component provides `seats` +// ([{ x, y, z, yaw }]) and may provide: +// spawn { x, z, yaw } where people arrive +// screen { x, y, z, yaw, width } where a shared screen first +// appears (screens.js): the middle of its picture. At +// yaw 0 it faces +z, toward someone who arrived with +// spawn yaw 0 +// confine(headPos) moves a head position back inside the walkable area +// floorAt(x, z) floor height there +// tools [{ name, label, object, grip, tip, butt, ink }]: things to +// pick up and draw with (wield.js). Each lies along its +// object's +x; grip, tip and butt are local Vector3s and +// ink is a '#rrggbb' color +// touchables [{ name, label(), distance(worldPos), use() }]: things +// to reach for in VR; the trigger calls use() (wield.js) +// Worlds that leave these out get the campfire's defaults in locomotion.js. +window.CurrentWorld = function (sceneEl) { + const el = (sceneEl || AFRAME.scenes[0]).querySelector('[data-world]'); + return (el && el.components[el.dataset.world]) || null; +}; -- cgit v1.2.3