【发布时间】:2020-07-06 06:20:17
【问题描述】:
我是 aframe 和 arjs 的新手,我想通过 hiro 路径展示我自己的 gltf 模型,我编写了以下代码:
<!-- include A-Frame obviously -->
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
<!-- include ar.js for A-Frame -->
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs>
<!-- define your gltf asset -->
<!--This is for add a text-->
<a-text value="Hello, World!"></a-text>
<a-assets>
<a-asset-item id="tree" src="models/gltf/manovella.gltf"></a-asset-item>
</a-assets>
<a-entity gltf-model="##tree"></a-entity>
<!-- define a camera which will move according to the marker position -->
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
</body>
当我运行我的代码并从摄像头中系上一个 hiro 标记时,我只看到“Hello world!”文本而不是我自己的模型,我检查浏览器控制台错误但我没有生成任何东西。
有人可以帮我一下吗?我在哪里加载自己的模型错了?
提前非常感谢
【问题讨论】:
-
尝试使用 arjs 和 aframe 的 newest versions,如果这没有帮助,请尝试在没有 ar.js 的情况下查看模型 - 也许它很大,或者偏离中心。
-
应该是gltf-model="#tree",而不是"##tree",我觉得只是打错了
-
@StéphaneAlbanese 不错,我也认为 aframe 0.6.0 还不支持 gltf 2.0。