首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >arjs不显示gltf模型

arjs不显示gltf模型
EN

Stack Overflow用户
提问于 2020-09-29 01:27:40
回答 1查看 175关注 0票数 1

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

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

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

我的代码如下。

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

发布于 2020-09-30 02:26:12

在你的控制台中检查是否有任何跨源资源共享错误-有时如果你的网站是通过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似乎也是一个类似的问题。也许你也可以试试它的答案。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64106867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档