【发布时间】:2022-04-23 01:38:37
【问题描述】:
我从 AR.js 开始,遇到很多问题,所以我尝试从基础重新开始。
我确实想在自定义标记上放置一个 gltf 文件
我在 (https://ar-js-org.github.io/AR.js-Docs/#troubleshooting-feature-requests-community) 的文档中查看了图像跟踪示例:
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
<style>
.arjs-loader {
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.arjs-loader div {
text-align: center;
font-size: 1.25em;
color: white;
}
</style>
<body style="margin : 0px; overflow: hidden;">
<!-- minimal loader shown until image descriptors are loaded -->
<div class="arjs-loader">
<div>Loading, please wait...</div>
</div>
<a-scene
vr-mode-ui="enabled: false;"
renderer="logarithmicDepthBuffer: true;"
embedded
arjs="trackingMethod: best; sourceType: webcam;debugUIEnabled: false;"
>
<!-- we use cors proxy to avoid cross-origin problems -->
<a-nft
type="nft"
url="https://arjs-cors-proxy.herokuapp.com/https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/trex-image/trex"
smooth="true"
smoothCount="10"
smoothTolerance=".01"
smoothThreshold="5"
>
<a-entity
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"
scale="5 5 5"
position="50 150 0"
>
</a-entity>
</a-nft>
<a-entity camera></a-entity>
</a-scene>
</body>
我复制了代码并进行了一个故障项目:
https://glitch.com/edit/#!/discreet-horn-fog?path=index3.html%3A54%3A7
但是,当我尝试打开它时,手机一直显示“正在加载,请稍候”。
我在某个地方读到了你必须使用的东西 要定义您的资产但无法使其发挥作用,我将不胜感激。
非常感谢。
亲切的问候。
【问题讨论】:
标签: javascript three.js augmented-reality aframe ar.js