【问题标题】:arjs not displaying gltf modelarjs 不显示 gltf 模型
【发布时间】:2020-09-30 02:26:11
【问题描述】:

我正在尝试根据网站上的教程制作一个简单的arjs应用程序,特别是this one

我已经能够成功地将其他 gltf 模型换成新代码,但是每当我尝试使用自己的模型时,它们都不会显示在应用程序中。

我已经在 https://gltf-viewer.donmccurdy.com/ 的查看器中测试了我的模型,它显示得很好。

我的代码如下。

<body style='margin : 0px; overflow: hidden;'>
    <!-- we add detectionMode and matrixCodeType to tell AR.js to recognize barcode markers -->
    <a-scene embedded vr-mode-ui="enabled: false" arjs="sourceType: webcam; debugUIEnabled: false; detectionMode: mono_and_matrix; matrixCodeType: 3x3;">

    <a-assets>
        <a-asset-item id="animated-asset" src="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Duck/glTF/Duck.gltf"></a-asset-item>
        <a-asset-item id="bimmer" src="https://raw.githubusercontent.com/jaggre/consortium/master/compresso.gltf"></a-asset-item>
    </a-assets>

    <a-marker type='barcode' value='2'>
        <a-entity 
        animation-mixer
        gltf-model="#bimmer"
        scale="4 4 4">
    </a-marker>

    <a-marker id="animated-marker" type='barcode' value='6'>
        <a-entity
            animation-mixer
            gltf-model="#animated-asset"
            scale="2 2 2">
        </a-entity>
    </a-marker>

    <a-entity camera></a-entity>
    </a-scene>
</body>

【问题讨论】:

  • 可能是你的模型太大了,也许你要缩小它...

标签: aframe ar.js


【解决方案1】:

在您的控制台中检查任何跨源资源共享错误 - 有时,如果您的网站是通过 http 托管或设置不同,则它不起作用。请参阅 https://aframe.io/docs/1.0.0/core/asset-management-system.html#cross-origin-resource-sharing-corshttps://aframe.io/docs/1.0.0/introduction/installation.html#use-a-local-server 。如果您只是在测试时使用 file:// 协议,它可能无法正常工作。

您可以尝试的其他方法是将模型的 a-entity 标记移到标记标记之外,以查看标记类是否对其产生影响。也许检查 A-frame 检查器 (Ctrl Alt I),如果它只是显示在错误的位置,请四处寻找。

更新:gltf2.0 not showing in ar.js project 似乎是一个类似的问题。也许也试试它的答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    • 2021-04-25
    • 2018-07-21
    • 2019-09-16
    • 2021-04-21
    • 2022-12-02
    • 2020-06-08
    相关资源
    最近更新 更多