Phipps
Phipps

Reputation: 355

Three.js change material

I try to select my geometry with the numbers on my keyboard, like this:

if(keyboard.pressed("1")){
   obj = torus;
}

so i can show/no show them:

if(keyboard.pressed("a")){
   THREE.SceneUtils.traverseHierarchy( obj, function ( obj ) { obj.visible = false; } );
}

I would like to change the material (or the color) of that "selected geometry" so i can see which is selected. How can I do that?

Upvotes: 1

Views: 1737

Answers (1)

mrdoob
mrdoob

Reputation: 19592

obj.material.color.setHex( 0xffff00 );

Upvotes: 2

Related Questions