/* 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); }; })();