【问题标题】:AR.js aframe object show also without pointing markerAR.js aframe 对象显示也没有指向标记
【发布时间】:2020-07-18 13:11:12
【问题描述】:

在我的 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 显示/隐藏?

提前非常感谢

【问题讨论】:

    标签: three.js aframe ar.js


    【解决方案1】:

    您的对象应该在您的标记内。尝试在您的场景中使用它:

    <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-24
      • 2020-01-12
      • 2021-05-10
      • 2018-05-06
      • 1970-01-01
      • 1970-01-01
      • 2013-05-29
      相关资源
      最近更新 更多