如何在运行时在 aframe 中加载 3D 对象?

Fel*_*lix 2 three.js webvr aframe

我正在开发一个需要运行时加载 3D 对象的 aframe 项目。我已阅读 A-Frame 文档,并且 aframe 似乎根本不支持运行时资产加载。

我通过 protyze ( https://github.com/protyze/aframe-asset-on-demand-component )发现了这个 aframe-asset-on-demand-component ,它似乎允许在运行时加载 img、音频和视频。但它的文档并未表明在运行时加载 .obj 或 .dae 中的文件等 3D 对象的可能性。

有没有人尝试过使用上述组件来实现 3D 对象的运行时加载?或者有没有其他方法可以达到这个目的?

ngo*_*vin 6

忽略,<a-assets>因为这是用于运行前网络预加载。

只需使用 setAttribute 设置模型组件:

el.setAttribute('gltf-model', 'path/to/model.gltf')

或者

el.setAttribute('obj-model', {obj: 'path/to/model.obj'})