I\'m trying to change the color of a cube based on a variable. I created two cubes and I want to change their color depending on the distance between them.
The cubes
You are not specifying the color value correctly.
cube.material.color.setHex( 0xffffff );