【发布时间】:2020-07-04 02:30:33
【问题描述】:
我刚刚开始学习使用 AR.js 创建 AR 场景,但在加载自定义 3D 模型时遇到了一些问题。我尝试了很多示例,所有示例都运行良好,但是一旦我插入自己的模型,它就不会显示出来。对于给定的示例和我的 3D 模型,我使用了几乎相同的代码,这就是:
<!DOCTYPE html>
<html>
<script src="https://aframe.io/releases/1.0.0/aframe.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs>
<a-marker preset="hiro">
<a-entity
position="0 0 0"
<!-- example given in AR.js docs -->
<!-- scale="0.05 0.05 0.05"
gltf-model="https://arjs-cors-proxy.herokuapp.com/https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/scene.gltf"
-->
<!-- my 3D model -->
scale="0.05 0.05 0.5"
gltf-model="model/scene.gltf"
></a-entity>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>
我的页面结构:
.
|_ index.html
|_ model
|_ scene.gltf
|_ scene.bin
我的模特:
https://sketchfab.com/3d-models/coronavirus-covid-19-virus-991102145c294fe4b633faecc23f3799
我尝试了许多其他模型、其他格式(.dae、.obj、.fbx),更改了模型的比例,但似乎没有任何效果。可能是什么问题?
【问题讨论】:
-
这看起来像是格式错误的 HTML。您在另一个标签内的属性中间有一个评论标签,我认为这是不允许的。
-
我刚刚为这个问题包括了这个。当我运行我的代码时它不存在:)
-
分享一个链接,指向重现您的问题的示例。把事情简单化。我会帮助人们帮助你。 glitch.com/~aframe
-
glitch.com/edit/#!/join/5bb2c2b3-3c9f-47c9-abd0-ce02c1d94c58 @DiegoMarcos 给你,希望成功
-
确保你的模型加载到gltf-viewer.donmccurdy.com
标签: 3d augmented-reality aframe gltf ar.js