我一直在尝试在 Angular 6 中实现 AR.js,但我似乎无法让它工作。
我在这里使用本指南实现了 A-frame:https ://medium.com/@pitipon/a-frame-with-angular-setup-project-5797b2f2a03b
即使 aframe 看似工作,我也无法真正让 ar.js 工作。我已经尝试像某些人所做的那样将其添加到 index.html 中,但这对我也不起作用。我还尝试使用 npm install 安装它并将其添加到 angular.json 中的脚本中,但似乎都没有帮助。
这是我的 app.component.html:
<a-scene embedded arjs='sourceType: webcam;'>
<a-marker preset='hiro'>
<a-box position="0 0.5 0" rotation="0 45 0" color="#4CC3D9"></a-box>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
我的 index.html 现在只是默认设置,因为在那里添加脚本似乎不起作用。
我可以通过将脚本添加到 index.html 并将 app.component.html 中的内容放在正文中而不是 app-root 中来使网络摄像头工作,但是它只会在我的控制台中填充错误并且无法检测到任何内容.
我似乎无法让它工作。如果有人能告诉我他们是如何做到的,我将非常感激。