three.js - AR.js aframe 对象显示也没有指向标记
问题描述
在我的 AR 项目中,当我用手机摄像头指向我的 hiro 图案时,我使用带有 aframe 的 arjs 来使我的 gltf 对象可见:
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<!-- include ar.js for A-Frame -->
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<script src="https://unpkg.com/aframe-orbit-controls@1.2.0/dist/aframe-orbit-controls.min.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>-->
<!--This is for add an image-->
<!--<a-image src="another-image.png"></a-image>-->
<a-assets>
<a-asset-item id="tree" src="models/gltf/manovella.gltf"></a-asset-item>
</a-assets>
<a-entity gltf-model="#tree" position="0 0 0" rotation="0 90 0" scale="10 10 10"></a-entity>
<a-entity camera look-controls orbit-controls="target: 0 1.6 -0.5; minDistance: 0.5; maxDistance: 180; initialPosition: 0 5 15">
<!-- define a camera which will move according to the marker position -->
<a-marker-camera preset='hiro'></a-marker-camera>
</a-entity>
</a-scene>
</body>
当我指向我的标记全部完成时,问题也是当我启动我的应用程序而不指向任何市场时,对象会出现,当我不再在框架中看到标记时,对象仍保留在屏幕上。如何管理仅与我的标记相关的 gltf 显示/隐藏?
非常感谢提前
解决方案
您的对象应该在您的标记内。尝试在您的场景中使用它:
<a-assets>
<a-asset-item id="tree" src="models/gltf/manovella.gltf"></a-asset-item>
</a-assets>
<!-- define a camera which will move according to the marker position -->
<a-marker-camera preset='hiro'><a-entity gltf-model="#tree" position="0 0 0" rotation="0 90 0" scale="10 10 10"></a-entity></a-marker-camera>
<a-entity camera look-controls orbit-controls="target: 0 1.6 -0.5; minDistance: 0.5; maxDistance: 180; initialPosition: 0 5 15"></a-entity>
推荐阅读
- ruby-on-rails - Rails:要么没有关联记录,要么没有由特定条件创建的关联记录
- unit-testing - TDD是基于单元测试的吗?
- java - 如何删除消息:拿起_JAVA_OPTIONS:-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
- c# - 使用按钮启动和停止线程
- javascript - 缩小页面时,上表保持不变,无法进行移动兼容。我该如何解决这个问题?
- java - 我可以在没有 build.xml 的情况下运行我的 ant 命令吗?
- android - 片段 sharedElement 返回转换不起作用(返回后视图可见性消失)
- flutter - 我的类型模型的列表小部件不能分配给相同的类型
- shell - 查找 2 个字符串之间的所有内容 - Sed
- android - 我的颤振应用程序拒绝使用 tesseract_ocr 包构建