【问题标题】:Ar.js not able to display glb modelAr.js 无法显示 glb 模型
【发布时间】:2020-09-03 13:06:32
【问题描述】:

我无法使用 ar.js 显示我的 glb 以进行图像跟踪 请查看我的网站https://ignaciostellino.github.io./ 我能够识别图像但不能显示 3D 模型。我想应该与比例和位置有关,但无法弄清楚。 这是我的代码:

<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@1c2407b26c61958baa93967b5412487cd94b290b/dist/aframe-master.min.js"></script>
<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 -->
    <!-- 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" -->
    <a-nft
      type="nft"
      url="ignaciostellino.github.io/smoothie-peque/smoothie-peque"
      smooth="true"
      smoothCount="10"
      smoothTolerance=".01"
      smoothThreshold="5"
    >
    <!-- 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" -->
      <a-entity gltf-model="Water/out.glb" scale="5 5 5"
            position="50 150 0" crossorigin="anonymous">
        <a-animation attribute="rotation" to = "360 0 0" dur="3000" easing="linear" repeat="indefinite"> </a-animation>
      </a-entity>
    </a-nft>
    <a-entity camera></a-entity>
  </a-scene>
</body>

【问题讨论】:

    标签: gltf ar.js


    【解决方案1】:

    我不确定是什么问题,可能是您的模型太小或太大。你怎么能确定标记被检测到?尝试使用&lt;a-gltf-model&gt; 而不是&lt;a-entity&gt;。您也可以使用我们的平台echoAR 上传您的模型并立即获得AR.js 体验链接(了解如何使用here)。您可以将您的代码与自动生成的代码进行比较,或者只使用您获得的 ARjs 链接。

    【讨论】:

      猜你喜欢
      • 2020-07-04
      • 2021-04-25
      • 1970-01-01
      • 2019-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-24
      • 2020-06-08
      相关资源
      最近更新 更多