(A-Frame)本地gltf文件无法加载;无法读取未定义的“slice”属性。

8

我从A-Frame School中获取了一段代码,其中加载了一个gltf模型。然后我尝试加载来自Khronos的示例模型this box,但是我遇到了这个错误(多次出现)。

GLTFLoader.js:979 Uncaught (in promise) TypeError: Cannot read property 'slice' of undefined
at GLTFLoader.js:979
at i (GLTFLoader.js:570)
at GLTFLoader.js:975
at <anonymous>

我可以加载 .obj 模型并尝试了几个版本的模型,但总是出现错误。
示例代码在本地工作正常,意味着它可以正确加载模型,从 aframe cdn 获取。
以下是完整代码:
<!DOCTYPE html>
<html>
  <head>
    <title>glTF Model</title>
    <meta name="description" content="glTF Model">
    <script src="https://rawgit.com/aframevr/aframe/b395ea0/dist/aframe-master.min.js"></script>
  </head>
  <body>
    <a-scene>
      <a-assets>
        <a-asset-item id="boxModel" src="Box.gltf"></a-asset-item>
      </a-assets>          
      <a-gltf-model src="#boxModel"></a-gltf-model>
    </a-scene>
  </body>
</html>  
2个回答

12

2
将Aframe版本更改为以下内容: <script src="https://aframe.io/releases/0.7.1/aframe.min.js"></script>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接