mrdoob/three.js — Issue #744: Assigning Material to Specific Faces of Geometry
Author: vance
Created: 2011-11-10 19:36:46+00:00
State: open

Hallo,
Since the materials array is deprecated, how might one assign a different material to each face? Let's do a simple cube example.

```
var materialA= new THREE.MeshLambertMaterial({color: 0x00ffaa });
cursorBox = new THREE.CubeGeometry(1, 1, 1);
cubeMesh = new THREE.Mesh(cursorBox, materialA);

// how I might have assigned materialB to face 1 prior to the change? Not sure.

var materialB = new THREE.MeshLambertMaterial({color: 0xff0000 });
mesh.materials.push( materialB);
cubeMesh.goemetry.faces[0].materialIndex = 1;

// my theory on how to do it now. It causes no error but fails to change anything.
// Waited for one render cycle to pass in case the material/geometry needs to bind

cubeMesh.geometry.faces[0].material = materialB ;

```

Any ideas? I may just be missing something fundamentally simple. I'm using a dev build 036caa6.