【问题标题】:"THREE.GLTFLoader: Unable to parse model" when running from a ftp从 ftp 运行时“THREE.GLTFLoader: Unable to parse model”
【发布时间】:2019-07-07 11:31:45
【问题描述】:

我正在尝试直接在网络浏览器中创建增强现实应用。在 10 行 HTML (https://medium.com/arjs/augmented-reality-in-10-lines-of-html-4e193ea9fdbf) 中使用 AR.js 提供了一个非常简单的解决方案。

但是当我尝试导入 Gltf 模型时遇到问题。它在本地服务器上运行良好,但是当我在 ftp 上上传文件时,gltf 模型不显示,而是在控制台中出现此错误:browser.js:111 components:gltf-model:warn THREE.GLTFLoader: Unable to parse model.

我对 web 开发和 javascript 非常陌生,我不知道这个错误来自哪里以及如何修复它。

这是页面的链接:https://lesfillesdu9novembre.com/ARWeb/Html/Page.html

这是我的代码:

<html>
    <head>
        <script src="https://aframe.io/releases/0.7.1/aframe.min.js"></script>
        <script src="https://rawgit.com/jeromeetienne/ar.js/master/aframe/build/aframe-ar.js"></script>
        <script>THREEx.ArToolkitContext.baseURL = 'https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script>
    </head>


    <body style='margin: 0px; overflow: hidden;'>
        <a-scene embeded arjs='trackingMethod: best; debugUIEnabled: false;'>
            <a-assets>

                <a-asset-item id="car" src="/GLTF/Exterior/Gltf/Exterior_006.gltf"></a-asset-item>

            </a-assets>

            <a-gltf-model src="#car" scale="0.01 0.01 0.01" rotation="0 0 0" position="-2.5 0 0" ></a-gltf-model>

            <a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>


            <a-marker-camera preset='hiro'></a-marker-camera>
        </a-scene>

    </body>

</html>


【问题讨论】:

    标签: javascript html gltf ar.js


    【解决方案1】:

    您的资产的 URL 似乎有误:https://lesfillesdu9novembre.com/GLTF/Exterior/Gltf/Exterior_006.gltf 不返回 gltf 模型,而是返回正常的灰色网站。

    【讨论】:

      猜你喜欢
      • 2012-10-30
      • 2022-12-28
      • 1970-01-01
      • 2016-12-05
      • 1970-01-01
      • 2012-09-24
      • 1970-01-01
      • 2023-01-03
      • 1970-01-01
      相关资源
      最近更新 更多