diff --git a/src/gltf-component-mappings.js b/src/gltf-component-mappings.js index 73c7d628ee70e5b1182f6a035a0aeef701488221..42980fddcc40396a726877ef65355817b2aa1dbb 100644 --- a/src/gltf-component-mappings.js +++ b/src/gltf-component-mappings.js @@ -72,3 +72,9 @@ AFRAME.GLTFModelPlus.registerComponent("nav-mesh", "nav-mesh", (el, _componentNa // nav-mesh-helper will query for it later. el.setAttribute("nav-mesh"); }); + +AFRAME.GLTFModelPlus.registerComponent("networked", "networked", (el, componentName, componentData) => { + // Mark this to act as a "full sync" from the GLTF scene itself, to avoid taking ownership. + el.firstUpdateData = componentData; + el.setAttribute(componentName, componentData); +}); diff --git a/src/hub.html b/src/hub.html index 4884abca46af25a088c333af4fab7ad673731ec9..c020970c5febc79025c88461266ddf4bbb79acf9 100644 --- a/src/hub.html +++ b/src/hub.html @@ -458,7 +458,12 @@ nav-mesh-helper static-body="shape: none;" > - <a-entity id="environment-scene"/> + <a-entity id="environment-scene"></a-entity> + </a-entity> + + <!-- Objects --> + <a-entity id="objects-root"> + <a-entity id="objects-scene"></a-entity> </a-entity> <a-entity diff --git a/src/hub.js b/src/hub.js index 904bb63de5df211c29a1153e6d7ec796d2e97234..92ff24a3679446fc65180f176878be799d14a46e 100644 --- a/src/hub.js +++ b/src/hub.js @@ -243,6 +243,12 @@ async function handleHubChannelJoined(entryManager, hubChannel, data) { console.log(`Scene URL: ${sceneUrl}`); const environmentScene = document.querySelector("#environment-scene"); + const objectsScene = document.querySelector("#objects-scene"); + const objectsUrl = + "https://farspark-dev.reticulum.io/0/raw/0/0/0/0/aHR0cHM6Ly91cGxvYWRzLWRldi5yZXRpY3VsdW0uaW8vZmlsZXMvMDAxODQ0NmEtY2NjMi00ODczLTkwMDItM2VkZmI4NzEzZTRmLmdsdGY_dG9rZW49MjVmOTVkMjhkODY1NzJhMjRhOTI4ZjJiNDExZTQ1YWE"; + const objectsEl = document.createElement("a-entity"); + objectsEl.setAttribute("gltf-model-plus", { src: objectsUrl, useCache: false, inflate: true }); + objectsScene.appendChild(objectsEl); if (glbAsset || hasExtension) { const gltfEl = document.createElement("a-entity");