Hubs-Foundation / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubsfoundation.org
Mozilla Public License 2.0
2.13k stars 1.41k forks source link

camera_tools.glb, spawn-point.glb, LoadingObject_Atom.glb fail to load on room entry #5807

Closed chris-metabi closed 1 year ago

chris-metabi commented 1 year ago

Description A fresh hubs cloud deploy (latest commit Oct 12 2022, 0a02497eedd21a10a690767a192147ec8e1065d2) installed on a new hubs stack (template from September 2022) fails on entering rooms. The errors point to GLB models failing to load: camera_tools.glb, spawn-point.glb, LoadingObject_Atom.glb. Room loading screen hangs and never displays room.

To Reproduce git clone https://github.com/mozilla/hubs, checkout hubs-cloud, deploy.

Expected behavior Room loads normally.

The fix as posted by Chris-King on the discord channels is to appent "?inline" to the end of those three filenames, which occur in four places:

src/prefabs/camera-tool.js src/hub.html src/prefabs/loading-object.js src/components/media-loader.js

chris-metabi commented 1 year ago

Further information, this appears to be a build/deploy error, as the missing models do not appear in the dist folder after "npm run build", while other models do. Also, strangely there are two dots before the "glb" extension in all of these filenames, both the working models and the missing ones.

chris-metabi commented 1 year ago

FIXED: Courtesy of albert_ on the discord channel,

(Apologies for weird formatting from the github infrastructure)

There is this section in webpack.config.js, around line 540:

if (rootPath.startsWith("src" + path.sep)) { console.log(rootPath); const parts = rootPath.split(path.sep); parts.shift(); rootPath = parts.join(path.sep); }

which needs to be replaced with this:

function stripSrcFromPath(pathSeperator) { const parts = rootPath.split(pathSeperator); parts.shift(); return parts.join(pathSeperator); }

              if (rootPath.startsWith("src" + path.sep)) {
                rootPath = stripSrcFromPath(path.sep);
              }

              if (rootPath.startsWith("src/")) {
                rootPath = stripSrcFromPath("/");
              }