Targeting specific material by name in the imported model
Posted
by
Aleksander Lenart
on Stack Overflow
See other posts from Stack Overflow
or by Aleksander Lenart
Published on 2012-06-19T12:09:48Z
Indexed on
2012/06/19
15:16 UTC
Read the original article
Hit count: 293
three.js
I'm trying to select a particular material in the imported model (via Collada loader) in Three.js. I know this can be done with the getChildByName
method but it just doesn't work for me. I couldn't find any working example with this method included, either.
What am I doing wrong here?
loader = new THREE.ColladaLoader();
loader.load('myModel.dae', function ( collada ) {
model = collada.scene;
var myMaterial = model.getChildByName( 'materialName', true );
myMaterial.material = new THREE.MeshBasicMaterial( { wireframe: true } );
});
© Stack Overflow or respective owner