当实体在标记上生成并且我移动相机时,实体就会消失。但是,我希望当相机聚焦在标记上时实体生成一次,并且即使相机失去焦点也保持可见。 参考
<!DOCTYPE html>
<html>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<!-- we import arjs version without NFT but with marker + location based support -->
<script src="https://raw.githack.com/AR-js-org/AR.js/dev/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"
rotation="0 0 0"
scale="0.05 0.05 0.05"
gltf-model="../image-tracking/nft/trex/scene.gltf"
></a-entity>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>
您正在使用标记来显示模型,但是您需要在无标记框架中生成模型,其中标记显示在某个位置并且可以在没有标记的情况下移动,为此您可以一起使用 ar.js 和 aframe。您可以参考此文档 - https://ar-js-org.github.io/AR.js-Docs/