如何在 aframe-v1.1.0.min 中使用 collada 模型 [英] How to use a collada model with aframe-v1.1.0.min

查看:26
本文介绍了如何在 aframe-v1.1.0.min 中使用 collada 模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自 2018 年以来,我一直使用 a-frame 向我工作的导演展示我的场景.我为我的对象使用了 colladas 文件,一切都很好,我的纹理也很好如我所愿.但是自从webxr(aframe-v1.1.0.min)出现后就不能再使用了collada 我试过 Gltf 文件,但它太重了,不能令人满意.所以我想知道如何将collada放回a-frame scipts中.我试过:collada-model-legacy.js"使用ColladaLoader.js"在另一个文件夹中,但它不起作用.你有解决方案吗?谢谢

I have been using a-frame since 2018 to show my scenographies to the directors I work for. I used the colladas files for my objects and everything was working great and my textures were as I wanted. But since the webxr (aframe-v1.1.0.min) appeared it is no longer possible to use collada I have tried the Gltf files but it is too heavy and not satisfactory. So I wanted to know how to put collada back into the a-frame scipts. I tried: "collada-model-legacy.js" with "ColladaLoader.js" in another folder but it doesn't work. Do you have a solution? Thank you

推荐答案

您可以使用three.js 存储库中的任何加载器 - 也可以使用 ColladaLoader.

You can use any of the loaders from the three.js repository - also the ColladaLoader.

您可以创建一个包装器组件,它将使用threejs 加载器并将模型添加到场景中:

You could create a wrapper component, which will use threejs loader and add the model to the scene:

AFRAME.registerComponent("foo", {
  init: function() {
    const el = this.el;
    // create a loader
    const loader = new THREE.ColladaLoader();
    // load the model
    loader.load("MODEL_URL", function(model) {
      el.object3D.add(collada.scene);
    })
  }
})

一个简单的例子可能是这个组件(看看使用静态和动画 collada 模型此处)

A simple example could be this component (check it out with static and animated collada models here)

这篇关于如何在 aframe-v1.1.0.min 中使用 collada 模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆