简体   繁体   中英

Painting only one line in Three.js

I have several lines in an array. When I want to paint just one a certain color, they are all painted that color instead. What can I can do to make it paint only the lines that I want?

图片范例

var materialSide = new THREE.LineBasicMaterial( { color: "#000000"} );
line[i] = new THREE.Line( Geometria[i], materialSide);
.
.
.
line[24].material.color=new THREE.Color( 0xffffff ); 
line[24].material.needsUpdate = true;

You are using the same material for all the lines; that is why you are seeing that effect. Create another material materialPainted that has the different color that you want and then you assign the materialPainted material to your line.

line[24].material = materialPainted;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM