问题
I am currently working on a project with three.js which include the usage of the OBJMTLloader.js, loading the obj and the mtl file
Here is my code:
var loader = new THREE.OBJMTLLoader();
loader.load( './three/obj/Colonne/Vertebres.obj','./three/obj/Colonne/Vertebres.mtl', function ( object ) {
object.position.y = - 70;
scene.add( object );
} );
I want to know if it is possible to change the opacity of the object/material once it's loaded. Thank you.
回答1:
In your loader callback, you can use a pattern like this one:
object.traverse( function( node ) {
if( node.material ) {
node.material.opacity = 0.5;
node.material.transparent = true;
}
} );
three.js r.64
来源:https://stackoverflow.com/questions/20825479/changing-opacity-with-objmtloader