krikey
krikey

Reputation: 195

How to change the color of a plane geometry in three.js? (always keeps giving me a black outcome)

I am adding a plane to the scene like this

   var plane = new THREE.Mesh(new THREE.PlaneBufferGeometry(300, 300), new THREE.MeshPhongMaterial({specular: '#fff',fog: false,color: '#ff9a00',shininess: 10 }));

Then I am changing that plane's color with

plane.material.color = '#ff9a00';

But all I get is a black plane after that color change. Before the color change, the plane is orange-brown color. After the color change it should still be orange-brown but it turn to pitch black no matter what color I try to change it to.

Upvotes: 1

Views: 2996

Answers (1)

WestLangley
WestLangley

Reputation: 104843

You are not specifying the color value correctly.

plane.material.color.setHex( 0xff9a00 );

See http://threejs.org/docs/#Reference/Math/Color

three.js r.73

Upvotes: 3

Related Questions