【问题标题】:gltf2.0 not showing in ar.js projectgltf2.0 未显示在 ar.js 项目中
【发布时间】:2020-09-25 00:23:06
【问题描述】:

我创建了一个这样的 ar.js 试用页面:

<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script>
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>


<body style='margin : 0px; overflow: hidden;'>
  <a-scene embedded arjs='sourceType: webcam;'>

<!-- handle marker with hiro preset -->
<a-marker preset='hiro'>
  <a-entity 
  gltf-model-next="src:url(lugia_pokemon/scene.gltf)"
  position="0 0 0"
  scale="1 1 1"></a-entity>
  <!-- <a-image src="corvette_stingray/image.jpg"></a-text> -->
  <!-- <a-text value="Hello" color="red"></a-text> -->
</a-marker>

<!-- <a-marker preset='hiro'></a-marker>
    <a-text value="Hello, this is Enze'a first AR try!" color="red"></a-text>
</a-marker> -->

<!-- add a simple camera -->
<a-entity camera></a-entity>

我启动 html 文件后它不工作。 gltf 位于与 .bin 相同的 html 目录下的文件夹中。使用 npm http-server 在 localhost 上运行也不能像控制台所暗示的那样工作。但是,如果我将实体更改为文本或框,它确实会显示。同样对于 a-image 它只显示一个没有任何图像的白框。

另外,当我用手机打开时,它无法获得网络摄像头的许可,但是当打开https://codepen.io/jeromeetienne/pen/mRqqzb 我的手机 chrome 应用程序会请求摄像头的许可并打开并工作。

谢谢你们!

【问题讨论】:

    标签: aframe ar.js


    【解决方案1】:

    尝试使用&lt;a-scene embedded arjs='sourceType: webcam; debugUIEnabled: false; trackingMethod: best;' antialias='true' gesture-detector&gt; 开始您的场景,它将帮助您使所有内容更加一致。另外,尝试将资产声明与其用途分开:

    <a-assets>
            <a-asset-item id="gltf=model" src="YOUR_SRC"></a-asset-item>
    </a-assets>
    
    <a-marker preset='hiro'>
        <a-gltf-model src="#gltf-model" scale="1 1 1" position="0 0 0">
        </a-gltf-model>
    </a-marker>
    

    您也可以尝试使用 echoAR(完全公开,我参与了这个项目)。有一个whole section that build's AR.js for you。您可以完全使用它,或者只是看看如何根据您获得的结果构建您的 HTML 文件。

    【讨论】:

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