Reputation: 11
I've created a cube like this
cube = new THREE.Mesh(
new THREE.CubeGeometry(50,20,50),
new THREE.MeshLambertMaterial({color: 0x6699ff})
);
scene.add(cube);
cube.position.set(80,32,40);
But I want to change the color of the cube, how could I do?
Any help would be appreciated. Thanks
Upvotes: 1
Views: 1813
Reputation: 1307
You can use this function:
var color = 0x421575; // Your color
cube.material.color.setHex( color );
The result is shown in those fiddles:
Hope this helps.
Upvotes: 1