首页 > 解决方案 > 桌面(chrome)aframe ar 失败;相机工作但没有盒子或模型不知道会发生什么

问题描述

以下是 aframe 博客上的示例代码。结果仅显示相机图像;没有盒子也没有模型:不知道会发生什么。模型在那里,js 库在那里。我应该在相机图像的某处看到盒子和模型吗?

    <!DOCTYPE html>
    <html>
    <head>
    <!-- include A-Frame obviously -->
    <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
        <script src="js/ColladaLoader.js"></script>
    <!-- include ar.js for A-Frame -->
    <script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
    </head>
    <body style=’margin : 0px; overflow: hidden;’&gt;
    <a-scene 
        embedded arjs=’sourceType: webcam;’&gt;
        <!-- create your content here. just a box for now -->
        <a-box position='0 0.5 0' material='opacity: 1 scale = "2 2 2" color="red";'
        >
        </a-box>
        <!-- define a camera which will move according to the marker position -->
        <a-entity camera
        >
        </a-entity>
        <a-marker preset=’hiro’&gt;
        </a-marker>
        <a-collada-model
                id = "titlexx1b"
                src="models/man_default.dae" position = "1 1 1" 
                scale = "1 1 1"
                >
            </a-collada-model>
      </a-scene>
    </body>
    </html>

标签: augmented-realityaframe

解决方案


您应该将盒子和模型添加到要放置它们的标记上。在这种情况下,hiro 标记。通常,不建议在一个标记上放置多个对象。另一件事是,我不确定 A-frame / AR.js 是否支持 DAE 文件。考虑使用支持的格式。


推荐阅读