How to setup materials in THREE.js when loading Collada (dae) models?

狂风中的少年 提交于 2019-11-30 10:23:33
var loader = new THREE.ColladaLoader();
loader.options.convertUpAxis = true;
loader.load( './models/cylinder.dae',function colladaReady( collada ) {

model = collada.scene;
model_geometry = collada.scene.children[ 0 ].geometry;
model_material = collada.scene.children[ 0 ].material;

model.scale.set(10.0, 10.0, 10.0);
model.updateMatrix();
});

if you are getting model_material as 'undefined', then take a look at collada object

console.log(collada);

sometimes there are children inside children, so you might have to do this:

model_material = collada.scene.children[ 0 ].children[ 0 ].material;

Take a look at collada model and then modify accordingly.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!