I am trying to set a specific color for each material in a skinned mesh. Having very strange behavior.
mesh.traverse( function ( child ) {
if ( child instanceof THREE.Object3D ) {
if(child.material !== undefined){
console.log("~ materials ~");
console.log(child.material);
child.material[5].emissive.setHex( 0xff0000 );
child.material[5].emissiveIntensity = 0.1;
child.material[5].color.setHex( 0xff0000 );
child.material[5].needsUpdate = true;
}
}
});
child.material is an array of 7 materials. If I set the color for materials index 0-5, nothing happens. If I set the material for index 6 (last in array) then it applies globally for all the materials – making it impossible to specify individual material colors. Not quite sure what is going on…
^ I was able to turn the entire model red by setting material “RollerSkatesmat” to red.
Maybe I am missing something very basic here?