1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* global AFRAME */
// The world that's loaded (campfire, temple, …) is the entity marked
// `data-world="<component>"` 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;
};
|