From c8ae4008660e25340acd184f6d2c45ac1c853518 Mon Sep 17 00:00:00 2001 From: Avaer Kazmer Date: Mon, 4 Nov 2019 23:36:46 -0500 Subject: [PATCH] Bugfix minefcraft.glb load path --- model-loader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model-loader.js b/model-loader.js index 076dab3..cfe0ccf 100644 --- a/model-loader.js +++ b/model-loader.js @@ -6,6 +6,8 @@ import './ProgressivePromise.js'; import './untar.js'; import './zip.js'; +const basePath = import.meta.url.replace(/[^\/]*$/, ''); + const _getFileType = filename => { if (/\.(?:gltf|glb|vrm)$/.test(filename)) { return 'gltf'; @@ -184,7 +186,7 @@ const loadModelUrl = async (href, filename = href) => { img.src = href; }); const model = await new Promise((accept, reject) => { - new THREE.GLTFLoader().load('./minecraft.glb', object => { + new THREE.GLTFLoader().load(`${basePath}minecraft.glb`, object => { accept(object.scene); }, xhr => {}, reject); });