我正在尝试将单个.JSON模型导出器从Blender加载到A-frame
我已经尝试使用此装载程序
https://github.com/donmccurdy/aframe-extras/tree/master/src/loaders
但模型没有出现。
以下是我正在尝试的内容:
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/styles.css">
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="components/json-model.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<a-asset-item id="model" src="models/stockcar.json"></a-asset-item>
</a-assets>
<a-entity json-model="src:#model" scale="0.5 0.5 0.5"></a-entity>
<a-camera position="0 0 20"></a-camera>
<a-light type="point" color="#3d8be6" position="-10 0 0" look-at="#car" intensity="5"></a-light>
<a-light type="hemisphere" color="#33b522" position="-10 0 0" intensity="1"></a-light>
</a-scene>
</body>
</html>
这就是控制台显示的内容
A-Frame Version: 0.5.0 (Date 10-02-2017, Commit #110055d)
index.js:74three Version: ^0.83.0
index.js:75WebVR Polyfill Version: dmarcos/webvr-polyfill#a02a8089b
json-model.js:7 Uncaught SyntaxError: Unexpected token <
three.js:19590THREE.WebGLRenderer 83
http://127.0.0.1:57153/favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)
非常感谢任何帮助
答案 0 :(得分:0)
首先,你有一个额外的&#34; /&#34;在资产项目开头标记的末尾:
<a-asset-item id="model" src="models/stockcar.json"/></a-asset-item>
其次,要使用资产,您必须在json-model&#34; src&#34;中说明资产的ID。属性:
<a-entity json-model="src:#model" scale="0.5 0.5 0.5"></a-entity>