[英]How to update particular part of a model in .dae file using Three.js and Collada Loader
采用:
var yourObject;
modelOrScene.traverse( (obj)=>{
if(obj.material && obj.material.map)
console.log(obj.name) //print all object names, and material map image paths..
if(obj.name == 'NameOfTheObjectWithTheTexture")
yourObject = obj;
})
在模型上查找具有纹理贴图的对象和材料的名称。
一旦知道哪个对象具有该材质+贴图,就可以使用以下方式加载新纹理
if(yourObject)
new THREE.TextureLoader().load( "yourOtherImage.png" ,(tex)=>{
yourObject.material.map = tex; //Replace the objects material once the new material is loaded.
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.