我正在尝试根据网站上的教程,特别是this one,制作一个简单的arjs应用程序
我已经能够成功地将其他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>发布于 2020-09-30 02:26:12
在你的控制台中检查是否有任何跨源资源共享错误-有时如果你的网站是通过http托管的,或者设置不同,它就不能工作。参见https://aframe.io/docs/1.0.0/core/asset-management-system.html#cross-origin-resource-sharing-cors和https://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似乎也是一个类似的问题。也许你也可以试试它的答案。
https://stackoverflow.com/questions/64106867
复制相似问题